根级别为“全部”时,是否存在仅用于输出日志的R函数?

时间:2018-12-28 14:00:43

标签: c# asp.net-mvc log4net

我将log4net用于Asp.Net MVC,并且希望在根级别设置为“全部”时支持输出日志。

<configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>

<log4net>
    <!-- Define output appenders -->
    <appender name="PageLoading_RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
        <file value="App_Data\\Logs\\PageLoading.log" />
        <appendToFile value="true" />
        <rollingStyle value="Once" /> <!-- new log file on restart -->
        <maxSizeRollBackups value="10"/> <!-- renames rolled files on startup 1-10, no more than 10 -->
        <maximumFileSize value="204800KB" /> 
        <datePattern value="yyyyMMdd" />
        <lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
        <layout type="log4net.Layout.PatternLayout">
            <param name="Header" value="[START LOG]&#13;&#10;" />
            <param name="Footer" value="[END LOG]&#13;&#10;" />
            <conversionPattern value="%d %-5level - %m%n" />
        </layout>
    </appender>

    <!-- Setup the root category, add the appenders and set the default level -->
    <root>
      <level value="ALL" />
      <appender-ref ref="PageLoading_RollingLogFileAppender" />
    </root>
</log4net>

我希望只有在将Web配置Log4Net设置为“所有”级别时,日志记录才是日志记录,但是实际输出是logger.Debug。

0 个答案:

没有答案