log4net使用的關鍵點

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


  < log4net >
    <  appender  name  = "  UpdateManagementClientLogFileAppender "  type = " log4net.Appender.FileAppender "  >
      <  file  type  = "  log4net.Util.PatternString "  value = " UpdateManagementClient.log "  />
      <  appendToFile  value  = "  true "  />
      <  rollingStyle  value  = "  Size "  />
      <  maximumFileSize  value  = "  10MB "  />
      <  maxSizeRollBackups  value  = "  10 "  />
      <  layout  type  = "  log4net.Layout.PatternLayout " >
        <  conversionPattern  value  = "  %date [%thread] %-5level - %message%newline "  />
      </  layout >
    </  appender >
    <  root >
      <  level  value  = "  ALL "  />
      <  appender-ref  ref  = "  UpdateManagementClientLogFileAppender "  />
    </  root >
  </ log4net >

AssemblyInfo.cs
[ assembly :  XmlConfigurator (Watch =  true )]

private  static  readonly  ILog  Log =  LogManager .GetLogger( MethodBase  .GetCurrentMethod().DeclaringType);

Log.Info("test").
相關文章
相關標籤/搜索