Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Oauth 2.0 在IdentityServer3中禁用信息日志记录_Oauth 2.0_Enterprise Library_Identityserver3 - Fatal编程技术网

Oauth 2.0 在IdentityServer3中禁用信息日志记录

Oauth 2.0 在IdentityServer3中禁用信息日志记录,oauth-2.0,enterprise-library,identityserver3,Oauth 2.0,Enterprise Library,Identityserver3,我正在使用IdentityServer3(构建2.3.0.0)和企业库进行日志记录。 目前,我的日志选项设置如下 var options = new IdentityServerOptions { LoggingOptions = new LoggingOptions() { EnableHttpLogging = false, EnableKatanaLogging = false, EnableWebAp

我正在使用IdentityServer3(构建2.3.0.0)和企业库进行日志记录。 目前,我的日志选项设置如下

 var options = new IdentityServerOptions
    {
      LoggingOptions = new LoggingOptions()
      {
         EnableHttpLogging = false,
         EnableKatanaLogging = false,
         EnableWebApiDiagnostics = false,
         WebApiDiagnosticsIsVerbose = false
       },
       EventsOptions = new EventsOptions()
       {
         RaiseErrorEvents = true,
         RaiseFailureEvents = true,
         RaiseInformationEvents = false,
         RaiseSuccessEvents = false
       }
    }
上述配置不会禁用以下条目的日志记录

Returning token response.
End token request
Creating JWT access token
Setting a sliding lifetime: 29100
Creating refresh token
Creating access token
Processing token request
Creating token response 
Start password token request validation
Start token request validation
Client validation success
Secret validator success: HashedSharedSecretValidator
Secret id found: JSApp
Parser found secret: PostBodySecretParser
Start parsing for secret in post body
X.509 certificate not found.
Start parsing for X.509 certificate
Start client validation
Start token request
CorsPolicyService allowed origin

如何禁用上述日志记录并只允许错误日志条目?

这只是将日志框架配置为不显示信息日志记录的问题。相反,只记录错误和致命日志。

如果要完全禁用日志记录,可以为LibLog配置NoopLoger,如:

LogProvider.SetCurrent(新的NoopLogProvider())


我已经知道如何配置EntLib配置以避免信息日志记录

如果
CategoryFilter
用作
logFilter
,则可以通过将
switchValue
设置为
Warning
(或根据需要设置任何其他值)来禁用信息记录


在这里,将
notProcessed
类别的
switchValue
设置为
Warning
,以避免信息性日志记录。

您的日志框架应该具有这些过滤功能。我相信这是在v2.5.0.0中引入的。但是,我使用的是2.3.0.0。无论如何,谢谢。你可以复制源代码-也可以使用2.3
<add switchValue="Warning" name="Information">
        <listeners>
          <add name="Database Trace Listener" />
        </listeners>
</add>
<specialSources>
    <allEvents switchValue="All" name="All Events" />
    <notProcessed switchValue="Warning" name="Unprocessed Category">
        <listeners>
             <add name="Database Trace Listener" />
        </listeners>
    </notProcessed>
    <errors switchValue="All" name="Logging Errors & Warnings"/>
</specialSources>