.net core log4net 配置


<log4net>
  <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender" >
    <file value="App_Data/Logs/Logs.txt" />
    <appendToFile value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="10" />
    <maximumFileSize value="10000KB" />
    <staticLogFileName value="true" />
    
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value=" 【时间】:%d%n 【级别】:%p%n 【类名】:%c%n 【线程ID】: %thread %n 【日志内容】:%m%n 【日记详细】:%exception %n---------------------------------------------------------------------------------------------------------------%n"/>
    layout>
    
    <filter type="log4net.Filter.LevelRangeFilter">
      <levelMin value="INFO" />
      <levelMax value="ERROR" />
    filter>
    
    
  appender>
  
  <root>
    <appender-ref ref="RollingFileAppender" />
    <level value="DEBUG" />
  root>
  <logger name="NHibernate">
    <level value="WARN" />
  logger>
log4net>

你可能感兴趣的:(.net,core,高级教程)