By multiple services do you mean separate .NET processes running as Services 
(i.e. start, stop, pause, resume)?

Is this what your startup code looks like?

private static void Main(string[] args)
{
    GlobalContext.Properties["BaseLogsDirectory"] = "c:\\Logs";

    XmlConfigurator.Configure();
}

----- Original Message ----
From: Chris White <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, January 16, 2008 6:21:04 PM
Subject: GlobalContext.Properties, RollingFileAppender, and PatternString

I have multiple services running using log4net on a system and would like to
globally set the base logging directory programmatically at startup.

It seems I should be able to set a BaseLogsDirectory property in 
GlobalContext.Properties
 and use it in a pattern string like this:

<file type="log4net.Util.PatternString" 
value="%property{BaseLogsDirectory}\logfilename" />

Although the property seems to added, the next log call ends up creating a 
"(null)" directory in the executing assembly's directory, where the files end 
up.


Am I forgetting something?

Thanks,
Chris





Reply via email to