Can anybody spot what I am doing wrong? I'm probably doing something stupid, 
but I've been banging my head against this for a few days and am getting no 
further:

I have a solution comprising two projects, a client app and a logger project. 
The logger project encapsulates calls to log4net. It has a line in its 
AssemblyInfo file

        [assembly: log4net.Config.XmlConfigurator(ConfigFile = 
"Log4Net.config", Watch = true)]

and static loggers and methods to call various loggers, eg

       private static readonly ILog bllDebugLog = 
LogManager.GetLogger("Matrix.Trace"); 

and so on.

a Typical logging method in the logger code is

        public static void Trace(string message)
        {
            using (NDC.Push("TRACE"))
            {
              bllDebugLog.Debug(message);
            }
        }


In the same solution I have an application which references the above assembly. 
The application makes calls to the static log methods, eg logger.Trace("a 
message");

and the log4net.config file is in the executable directory of the application 
(...\bin\debug and ...\bin\release).

It all seems straight out of the book, but try as I might I cannot get log4net 
to log anything!

The bare bones of the log4net.config file is:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
        <log4net>


                <appender name="RollingFileAppenderROOT" 
type="log4net.Appender.RollingFileAppender">
                        <file value="c:\logs\MatrixROOT.log" />
                        <layout type="log4net.Layout.PatternLayout">
                                <conversionPattern value="%m%newline" />
                        </layout>
                        <appendToFile value="true" />
                        <maximumFileSize value="100KB" />
                        <maxSizeRollBackups value="2" />
                </appender>


                <appender name="RollingFileAppenderTRACE" 
type="log4net.Appender.RollingFileAppender">
                        <file value="c:\logs\MatrixTRACE.log" />
                        <layout type="log4net.Layout.PatternLayout">
                                <conversionPattern value="%m%newline" />
                        </layout>
                        <appendToFile value="true" />
                        <maximumFileSize value="100KB" />
                        <maxSizeRollBackups value="2" />
                </appender>


                <root>
                        <appender-ref ref="RollingFileAppenderROOT" />
                </root>

                <logger name="Matrix.Trace">
                         <!--this is for routine debug logging to a file--> 
                        <level value="DEBUG" />
                        <appender-ref ref="RollingFileAppenderTRACE" />
                </logger>

        </log4net>
</configuration>


TIA

Neil

Reply via email to