整理如下:
- 在 public 下新增一個檔案 log4net.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>
<!-- Define some output appenders -->
<appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net" >
<param name="File" value="log.txt" />
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="yyyy.MM.dd" />
<param name="StaticLogFileName" value="true" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] (%X{auth}) - %m%n" />
</layout>
</appender>
<root>
<!-- priority value can be set to ALL|INFO|WARN|ERROR -->
<priority value="INFO" />
<appender-ref ref="rollingFile" />
</root>
</log4net>
</configuration> - 在 public/web.config 裡面,註冊 service:
<monorail>
<services>
<service
id="Custom"
interface="Castle.Core.Logging.ILoggerFactory, Castle.Core"
type="Castle.Services.Logging.Log4netIntegration.Log4netFactory, Castle.Services.Logging.Log4netIntegration" />
</services>
<!--略...-->
沒有留言:
張貼留言