You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by tinhuty he <ti...@hotmail.com> on 2006/06/08 03:05:26 UTC

how to set property for application level

How can I set a property in application level so that all logs produced from 
that application will have this property in log file, including all logs 
produced from other assemblies used by this application?

For example I want to all my log has an property "appname" to stored the 
value of application name. I tried to set an application name:
ThreadContext.Properties["appname"] = "App1";
This doesn't work as what I wanted. Some of the log entries don't have this 
property.

How should I approach it?

Thanks.


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to 
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement


Re: how to set property for application level

Posted by Ron Grabowski <ro...@yahoo.com>.
Have you tried the GlobalContext?

--- tinhuty he <ti...@hotmail.com> wrote:

> How can I set a property in application level so that all logs
> produced from 
> that application will have this property in log file, including all
> logs 
> produced from other assemblies used by this application?
> 
> For example I want to all my log has an property "appname" to stored
> the 
> value of application name. I tried to set an application name:
> ThreadContext.Properties["appname"] = "App1";
> This doesn't work as what I wanted. Some of the log entries don't
> have this 
> property.
> 
> How should I approach it?
> 
> Thanks.