How to set up log4net?
Hi ~
How can I set up log4net to work? Is it possible to do it programmatically? I don't want to change the config file each time I run lprun.exe. If this can be done, can you show me how, please?
Thanks.
How can I set up log4net to work? Is it possible to do it programmatically? I don't want to change the config file each time I run lprun.exe. If this can be done, can you show me how, please?
Thanks.
Comments
LogHelper Class Setting up the global Log variable Writing something to Log Nothing happens. Any idea what I'm missing? Or what I should be doing?
* In the Properties for Linqpad.config, I changed the Build Action to "Content" and Copy to Output Directory to "Copy always".
* I created a LinqPadHelper class with the following code * Then I added this code to my AssemblyInfo.cs * Finally, this is what my Program.cs looks like
I've created a simple test query that uses log4net in LINQPad here:
http://share.linqpad.net/ouuq7q.linq
Note that I'm calling XmlConfigurator.Configure - I believe you need to do this to get log4net to read the application configuration file.
Also note the app.config config (press F4 and click the app.config tab). I've included the config here with the query, but if you prefer, you can save it to a file and point LINQPad to that file instead, so you can re-use it more easily between queries. You could also put it in default LINQPad.config file.
Hope this helps!
https://stackoverflow.com/a/1999446/46223
You can also press Shift+F5 to terminate the underlying process and release the lock in LINQPad.