标签:ber 数据库配置 ref type targe dtd ring ack nbsp
参考配置
<?xml version="1.0" encoding="utf-8" ?> <log4net> <!--<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender" >--><!--指定输入到文本--> <appender name="RollingFileAppender" type="log4net.Appender.ADONetAppender" ><!--指定输入到数据库--> <!--定义数据库配置--> <bufferSize value="1" /><!--bufferSize表示是记录10 条到缓冲区,满10条后再写入SQL server,测试时将其改为1,生产环境建议100--> <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <connectionString value="DATABASE=SimpleTaskSystemDb;SERVER=.;UID=sa;PWD=123456;Connect Timeout=15;" /> <commandText value="INSERT INTO ErrorLog ([dtDate],[sThread],[sLevel],[sLogger],[sMessage],[sException]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)" /> <!--定义各个参数--> <parameter> <parameterName value="@log_date" /> <dbType value="DateTime" /> <layout type="log4net.Layout.RawTimeStampLayout" /> </parameter> <parameter> <parameterName value="@thread" /> <dbType value="String" /> <size value="100" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%t" /> </layout> </parameter> <parameter> <parameterName value="@log_level" /> <dbType value="String" /> <size value="200" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%p" /> </layout> </parameter> <parameter> <parameterName value="@logger" /> <dbType value="String" /> <size value="500" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%logger" /> </layout> </parameter> <parameter> <parameterName value="@message" /> <dbType value="String" /> <size value="3000" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%m" /> </layout> </parameter> <parameter> <parameterName value="@exception" /> <dbType value="String" /> <size value="4000" /> <layout type="log4net.Layout.ExceptionLayout" /> </parameter> <!--定义文件存放位置--> <file value="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="%-5level %date [%-5.5thread] %-40.40logger - %message%newline" /> </layout> </appender> <root> <appender-ref ref="RollingFileAppender" /> <level value="DEBUG" /> </root> <logger name="NHibernate"> <level value="WARN" /> </logger> </log4net>
demo下载:http://pan.baidu.com/s/1c1I7FaS
详细讲解:http://www.cnblogs.com/LiZhiW/p/4317198.html
标签:ber 数据库配置 ref type targe dtd ring ack nbsp
原文地址:http://www.cnblogs.com/zd1994/p/6805663.html