change-日志生成

collectionStore
liuwf 11 months ago
parent d41eae7137
commit d34e636509

@ -254,6 +254,9 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<Content Include="log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>

@ -48,8 +48,5 @@
<Compile Include="LogHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="config\log4net.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -27,8 +27,8 @@ namespace HighWayIot.Log4net
*
*
*/
//private readonly string fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config");
private readonly string fileName = "E:\\桌面\\澳柯玛MES项目\\程序设计\\Aucma.Scada\\HighWayIot.Log4net\\config\\log4net.config";
private readonly string fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log4net.config");
// private readonly string fileName = "E:\\桌面\\澳柯玛MES项目\\程序设计\\Aucma.Scada\\HighWayIot.Log4net\\config\\log4net.config";
private LogHelper()
{

@ -1,153 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="System.Configuration.IgnoreSectionHandler"/>
</configSections>
<appSettings>
</appSettings>
<log4net>
<!--错误日志类-->
<logger name="logerror">
<level value="ALL" />
<appender-ref ref="ErrorAppender" />
</logger>
<!--信息日志类-->
<logger name="loginfo">
<level value="ALL" />
<appender-ref ref="InfoAppender" />
</logger>
<!--PLC日志类-->
<logger name="plclog">
<level value="ALL" />
<appender-ref ref="PlcAppender" />
</logger>
<!--RFID日志类-->
<logger name="rfidlog">
<level value="ALL" />
<appender-ref ref="RfidAppender" />
</logger>
<!--RFID日志类-->
<logger name="viewlog">
<level value="ALL" />
<appender-ref ref="ViewAppender" />
</logger>
<!--Sql日志类-->
<logger name="sqllog">
<level value="ALL" />
<appender-ref ref="SqlAppender" />
</logger>
<!--信号量日志类-->
<logger name="semaphorelog">
<level value="ALL" />
<appender-ref ref="SemaphoreAppender" />
</logger>
<!--错误日志附加介质-->
<appender name="ErrorAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxSizeRollBackups" value="100" />
<param name="MaxFileSize" value="10240" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"LogError.html"'/>
<param name="RollingStyle" value="Date" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;HR COLOR=red&gt;%n异常时间%d [%t] &lt;BR&gt;%n异常级别%-5p &lt;BR&gt;%n异 常 类:%c [%x] &lt;BR&gt;%n%m &lt;BR&gt;%n &lt;HR Size=1&gt;" />
</layout>
</appender>
<!--信息日志附加介质-->
<appender name="InfoAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" />
<param name="MaxSizeRollBackups" value="100" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"LogInfo.txt"' />
<param name="RollingStyle" value="Date" />
<!--信息日志布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;--------------&gt;%n日志时间%d [%t] %n日志级别%-5p %n日志内容%m %n " />
</layout>
</appender>
<!--PLC日志附加介质-->
<appender name="PlcAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" />
<param name="MaxSizeRollBackups" value="100" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"PlcLog.txt"' />
<param name="RollingStyle" value="Date" />
<!--信息日志布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;--------------&gt;%n日志时间%d [%t] %n日志级别%-5p %n日志内容%m %n " />
</layout>
</appender>
<!--Rfid日志附加介质-->
<appender name="RfidAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" />
<param name="MaxSizeRollBackups" value="100" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"RfidLog.txt"' />
<param name="RollingStyle" value="Date" />
<!--信息日志布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;--------------&gt;%n日志时间%d [%t] %n日志级别%-5p %n日志内容%m %n " />
</layout>
</appender>
<appender name="ViewAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" />
<param name="MaxSizeRollBackups" value="100" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"ViewLog.txt"' />
<param name="RollingStyle" value="Date" />
<!--信息日志布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;--------------&gt;%n日志时间%d [%t] %n日志级别%-5p %n日志内容%m %n " />
</layout>
</appender>
<appender name="SqlAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" />
<param name="MaxSizeRollBackups" value="100" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"SqlLog.txt"' />
<param name="RollingStyle" value="Date" />
<!--信息日志布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;--------------&gt;%n日志时间%d [%t] %n日志级别%-5p %n日志内容%m %n " />
</layout>
</appender>
<appender name="SemaphoreAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\" />
<param name="AppendToFile" value="true" />
<param name="MaxFileSize" value="10240" />
<param name="MaxSizeRollBackups" value="100" />
<param name="StaticLogFileName" value="false" />
<param name="DatePattern" value='yyyy-MM-dd/"SemaphoreLog.txt"' />
<param name="RollingStyle" value="Date" />
<!--信息日志布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;--------------&gt;%n日志时间%d [%t] %n日志级别%-5p %n日志内容%m %n " />
</layout>
</appender>
</log4net>
</configuration>
Loading…
Cancel
Save