First, thanks for the assistance.
Okay so I took out %logger from the configuration
<appender name="DebugAppender" type="log4net.Appender.DebugAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level [%thread] -
%message%newline" />
</layout>
</appender>
<appender name="RollingFileAppender"
type="log4net.Appender.RollingFileAppender">
<file value="c:\app.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="100KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level [%thread] %logger -
%message%newline" />
</layout>
</appender>
and this is what I got
com.pf.util.implementation.AppConfigurationImpl: 2010-05-11
12:50:05,466 DEBUG [9] - handling sessionStart event
I am grabbing the logger by Type using
protected static new readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
and my current configuration only has the root logger defined
<root>
<level value="DEBUG" />
<appender-ref ref="DebugAppender" />
<appender-ref ref="RollingFileAppender" />
</root>
Interesting enough the entries in my RollingFileAppender are coming out exactly
as I expected.
2010-05-11 13:33:54,150 DEBUG [13]
com.purefacts.util.reports.implementation.ReportingApplicationConfigurationImpl
- handling sessionStart event
From: Ross Hinkley [mailto:[email protected]]
Sent: Tuesday, May 11, 2010 1:30 PM
To: Log4NET User
Subject: Re: Controlling the log message format
Won't %logger contain the logger name? How are you retrieving the logger from
the log manager? If you're using it by type, and are using the root logger, I
believe the log name defaults to the namespace of your binary.
-Ross
On Tue, May 11, 2010 at 12:17 PM, Steven Whatmore
<[email protected]> wrote:
That is what I thought - but no luck with that - I can't remember which class I
was looking at but it sure looks like you can't control that prefix value -
which I thought was very strange
From: Ross Hinkley [mailto:[email protected]]
Sent: Tuesday, May 11, 2010 1:07 PM
To: Log4NET User
Subject: Re: Controlling the log message format
This should be controllable via the conversionPattern. Something like the
following in your appender, maybe?
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level - %message%newline" />
</layout>
-Ross
On Tue, May 11, 2010 at 11:58 AM, Steven Whatmore
<[email protected]> wrote:
Good morning,
I would like to be able to control the format of the message, removing the
initial prefix
As an example if the format of my message is:
com.pf.util.implementation.AppConfigurationImpl: 2010-05-11 12:50:05,466
DEBUG [9] com.pf.util.implementation.AppConfigurationImpl - handling
sessionStart event
I would like to remove the initial
"com.pf.util.implementation.AppConfigurationImpl" part resulting in:
2010-05-11 12:50:05,466 DEBUG [9]
com.pf.util.implementation.AppConfigurationImpl - handling sessionStart event
I have tried it through configuration but can't seem to control the prefix
I took a quick look through the code and as far as I can tell this is not
configurable.
Am I correct?
Whatty