본문 바로가기
Language/C#

log4net 설정

by ninanio3 2017. 8. 9.

log4net

닷넷계열의 로그를 남길 수 있다.

설정은 아래와같다. app.config에다 넣어주면 된다.

<configuration></configuration> 사에이 넣는다.

 

 

<log4net>
    <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
      <file value="D:\log\THE\FCT\client\\" />
      <datepattern value="yyyy\\\\MM\\\\yyyyMMdd-HH'_Client.log'"/>
      <appendtofile value="true" />
      <maximumfilesize value="10MB" />
      <maxsizerollbackups value="2" />
      <staticlogfilename value="false"/>
      <rollingstyle value="Date"/>
      <layout type="log4net.Layout.PatternLayout">
        <!--conversionpattern value="%level %thread %logger - %message%newline" / -->
        <conversionpattern value="%d{yyyy/MM/dd HH:mm:ss} [%-5p] %m%n"/>
      </layout>
    </appender>
    <!-- Set root logger level to DEBUG and its only appender to A1 -->
    <root>
      <level value="INFO" />
      <appender-ref ref="RollingFile" />
    </root>
  </log4net>