I'm using log4net for logging of my web stuff. I use a remoting appender and I have a little console application that receives the messages and writes them to the log file. It's all working fine. I'm now in the process of converting the console application to a windows service and like to retrieve some settings from the the log4net configuration so when the service starts, I can write this info in the event log. What I like to get out are the name of the logfile as well as the remoting port. Any help is highly appreciated.
App.config
I've tried a couple of things; for the filename, I have managed to get the appender name (using GetRepository() and getAppenders()) but got stuck after that. For the second one, I have had no success. For both I've also tried the ConfigurationManager without success.
I clearly don't know how this stuff works ;) I do not necessarily need a pre-chewed code (although it might make it easier for me to understand how this stuff works), just some pointers as on how to access those keys / values can do for now.
Thanks in advance.
Replies
Know the answer? Post it — somebody with the same question will find it here.