Loading NLog.config file

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Loading NLog.config file

Rajmund Paczkowski
Is there possibility to load NLog.config file on demand?
Reply | Threaded
Open this post in threaded view
|

Re: Loading NLog.config file

Jason LaFlair
Administrator
Could you give us the scenario of how/why you would want to do this?
Reply | Threaded
Open this post in threaded view
|

Re: Loading NLog.config file

Rajmund Paczkowski
I've already found solution.

LoggingConfiguration config = new XmlLoggingConfiguration(file);
NLog.LogManager.Configuration = config;
Reply | Threaded
Open this post in threaded view
|

Re: Loading NLog.config file

Jason LaFlair
Administrator
That's actually what nlog does itself first time it's called to log something.  So why would you want to do that manually yourself?

Just curious.
Reply | Threaded
Open this post in threaded view
|

Re: Loading NLog.config file

Rajmund Paczkowski
I have a desktop application which runs on users computers with configured NLog to send logs to mailbox. All mailbox settings espacially login and password are written in clear text. If user is smart enough he can open config file and then log in to mailbox and for example change password to the mailbox. So now I deliver encrypted NLog.config file with application and during runtime file is decrypted and loaded by NLog.