hi. ich versuche verzweifelt log4net zu verwenden nur leider tut sich nichts (auch keine exception oder dergleichen )..
also meine app.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<section name="MyAgent.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<applicationSettings>
<MyAgent.Properties.Settings>
<setting name="MailboxAgent" serializeAs="String">
<value>MailboxAgent</value>
</setting>
<setting name="CustomHeader" serializeAs="String">
<value>X-Unverified-Sender</value>
</setting>
<setting name="LogFilePath" serializeAs="String">
<value>C:\\agent\\Log.txt</value>
</setting>
<setting name="Password" serializeAs="String">
<value>h1abc60*@</value>
</setting>
<setting name="MessageCheckIntervall" serializeAs="String">
<value>5</value>
</setting>
<setting name="MessageLifeTime" serializeAs="String">
<value>10</value>
</setting>
<setting name="AntiSpamConnection" serializeAs="String">
<value>Server=(local)\SqlExpress;Integrated security=SSPI;database=AntiSpam</value>
</setting>
</MyAgent.Properties.Settings>
</applicationSettings>
<log4net>
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<param name="File" value="C:\\agent\\LogTest2.txt" />
<param name="AppendToFile" value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="Header" value="[Header]\r\n" />
<param name="Footer" value="[Footer]\r\n" />
<param name="ConversionPattern" value="%d [%t] %-5p %c %m%n" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
</configuration>
AssemblyInfo.cs
[assembly: log4net.Config.XmlConfigurator()]
Verwendung:
private static readonly ILog Log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
Log.Info("blabla")
natürlich log4net referenziert und in gleiches directory wie dll getan
jemand ne idee ?
lg kutz