|
From: Erich E. <eei...@gm...> - 2010-01-22 19:05:00
|
Hi,
you still need to use
log4net.GlobalContext.Properties["BrokerID"] = 10
to set this property, even when using Common.Logging. CL only wraps the log4net API but doesn't implement its own logic. Although in the works, CL does not support vendor-neutral contexts yet.
Put the above line on the entry point of your application, in webapps this usually is Application_Start(), in clientapss put it as first method into Main()
hth,
Erich
From: Kyle LeNeau [mailto:kyl...@te...]
Sent: Friday, January 22, 2010 5:31 PM
To: net...@li...
Subject: [Netcommon-developer] log4net properties in Common.Logging
Does anyone know if there is an equivalent in Common.Logging (for .Net) to set properties for the log4net factory adapter? I have had great success when just using log4net by doing:
<appender name="FileAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="logs\Log_%property{BrokerID}.txt"/>
<appendToFile value="false"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="-1"/>
<maximumFileSize value="50GB"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level %logger - %message%newline"/>
</layout>
</appender>
and setting the property like:`log4net.GlobalContext.Properties["BrokerID"] = 10`
The file I end up with the looks like this: `Log_(null).txt` when using the common.logging to wire up log4net on the fly.
--
Kyle LeNeau
WhereToLive.com
7695 Anagram Drive
Eden Prairie, MN 55344
Call: 952-294-8080
Fax: 952-294-8181
kyl...@te...
www.WhereToLive.com
|