Hi Everyone,
I'm facing a problem when trying to log my application using log4net. My application consists of a WCF service, and clients connecting to it. Logging at client-side is not a problem, everything works perfectly.
Here is how my server-side is made:
- A WCF dll, which contains my service's contract and base implementation (including error handling). Actual operations are made in a separate business layer, which throws the needed exceptions which are caught by the implementation (and sent back using FaultContracts).
- A data layer (not a problem here).
- A "Utils" library, which contains my wrapper log methods.
My log4net.config file is the following:
<?xml version="1.0" encoding="utf-8" ?>
<log4net debug="false">
<appender name="TechnicalFileAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="c:\\log\\technical.log"/>
<param name="AppendToFile" value="true"/>
<param name="RollingStyle" value="Date"/>
<param name="DatePattern" value="'_'yyyyMMdd-HH"/>
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%-5t] %-5p - %m%n"/>
</layout>
</appender>
<root>
<level value="ALL"/>
</root>
<logger name="TechnicalLog">
<level value="ALL"/>
<appender-ref ref="TechnicalFileAppender"/>
</logger>
</log4net>
So when an error occurs in the business layer, it is captured, logged and transformed into a FaultException. There is the problem. No log file is created. I googled and found some clues (access rights generally, but I used ProcMon and found no call to the desired file or directory).
I'm a bit lost now, I don't know what to try.
I publish my service using the "publish" command in visual studio, so on the server I have my application directory, inside there is a svc file, a web.config file, and then a bin directory with all my dll's including the log4net.dll, and log4net.config. I tried to copy that config file in the root of my application without success.
I also tried to place the
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
statement in my WCF's AssemblyInfo.cs (it was originally in the Utils's AssemblyInfo.cs), but without any success.
Thanks for you help, any idea is welcome !