上文中讲到配置日志模块的第二步,这篇文章继续给大家介绍日志配置方法。
Step 3.在</configSections>后加入:(注意,以下配置与Step 2中的sectionGroup一一对应)
代码
<IsLine.AppLog.Configuration>
<FileRender>
<AppenderStyle>File</AppenderStyle>
<AppenderType>Text</AppenderType>
<AppenderInf>IsLineLog/Log4Net1.txt</AppenderInf>
<AppenderContent>->Event Date:@eventDate;->Level:@level;- >Message:@exception;->Source:@source;->Stack Trace:@StackTrace- >Trigger:@trigger;->Memo:@message</AppenderContent>
<LayoutInf></LayoutInf>
<Level>Debug</Level>
</FileRender>
<OracleUsingSPRender>
<AppenderStyle>Oracle</AppenderStyle>
<AppenderType>StoredProcedure</AppenderType>
<AppenderInf>IsLine.Data.Configuration.OracleConnectString</AppenderInf>
<AppenderContent>SP_ADD_ILFWLOG.ADD_ILFWLOG</AppenderContent>
<LayoutInf></LayoutInf>
<Level>Debug</Level>
</OracleUsingSPRender>
<OracleUsingTextRender>
<AppenderStyle>Oracle</AppenderStyle>
<AppenderType>Text</AppenderType>
<AppenderInf>add key</AppenderInf> //可以填add key,如果add key不存在则会使 用DataBaseConnection
<AppenderContent>"INSERT INTO IsLineFAppLog ([EventDate],[Level],[Source], [Trigger],[Message],[Exception]) VALUES (@eventDate, @level, @source,@trigger, @message, @exception)" </AppenderContent>
<LayoutInf></LayoutInf> //返回给用户的样式
<Level>Debug</Level>
</OracleUsingTextRender>
<SQLServerUsingTextRender>
<AppenderStyle>SQLServer</AppenderStyle>
<AppenderType>Text</AppenderType>
<AppenderInf>add key</AppenderInf> //可以填add key,如果add key不存在则会使 用DataBaseConnection
<AppenderContent>"INSERT INTO IsLineFAppLog ([ILEventDate],[ILLevel],[ILSource], [ILTrigger],[ILMessage],[ILException]) VALUES ('@eventDate', '@level', '@source','@trigger', '@message', '@exception')" </AppenderContent>
<LayoutInf></LayoutInf> //返回给用户的样式
<Level>Debug</Level>
</SQLServerUsingTextRender>
<SQLServerUsingSPRender>
<AppenderStyle>SQLServer</AppenderStyle>
<AppenderType>StoredProcedure</AppenderType>
<AppenderInf>add key</AppenderInf> //可以填add key,如果add key不存在则会使 用DataBaseConnection
<AppenderContent>IsLineLogSPRender</AppenderContent>
<LayoutInf></LayoutInf> //返回给用户的样式
<Level>Debug</Level>
</SQLServerUsingSPRender>
<MailRender>
<AppenderStyle>Mail</AppenderStyle>
<AppenderType>HTML</AppenderType>
<AppenderInf>收件人</AppenderInf>
<AppenderContent>邮件内容:@eventDate, @level, @source,@trigger, @message, @exception</AppenderContent>
<LayoutInf></LayoutInf> //返回给用户的样式
<Level>Debug</Level>
</MailRender>
</IsLine.AppLog.Configuration>