Re: pass parameter back to NLOG configuration

2 messages Options
Embed this post
Permalink
Normalex

Re: pass parameter back to NLOG configuration

Reply Threaded More More options
Print post
Permalink
Hello list,

there is a need to pass a contextual parameter to nlog config file
just before logmanager initialisation.

in log4net i did through the following trick:

// code

log4net.ThreadContext.Properties["LogFilePath"] = @"\\server\share\log.txt";
XmlConfigurator.Configure(new System.IO.FileInfo("config.xml"));

// config.xml file

<appender name="RollingLogFileAppender" type="log4netTest.RollingFileAppender">
       <encoding value="Unicode" />
       <file type="log4net.Util.PatternString" value="%property{LogFilePath}" />
.........
.........

--
Sincerely,
Alexander N.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
Normalex

Re: pass parameter back to NLOG configuration

Reply Threaded More More options
Print post
Permalink
Never mind.
Found answer here
http://n2.nabble.com/Changing-file-Location-at-runTime-td1685969.html

thank you so much for such an excellent logger library.

2009/7/15 Alexander <[hidden email]>:

> Hello list,
>
> there is a need to pass a contextual parameter to nlog config file
> just before logmanager initialisation.
>
> in log4net i did through the following trick:
>
> // code
>
> log4net.ThreadContext.Properties["LogFilePath"] = @"\\server\share\log.txt";
> XmlConfigurator.Configure(new System.IO.FileInfo("config.xml"));
>
> // config.xml file
>
> <appender name="RollingLogFileAppender" type="log4netTest.RollingFileAppender">
>        <encoding value="Unicode" />
>        <file type="log4net.Util.PatternString" value="%property{LogFilePath}" />
> .........
> .........
>
> --
> Sincerely,
> Alexander N.
>



--
Sincerely,
Alexander N.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list