Log4net Advice



  • I'm porting/rewriting a data processing app that was written (badly) by contractors.

    This app optionally outputs several different types of log files. There's also a requirement that we use log4net for the application, so I've done that.

    Now I know log4net is fine for diagnostic and debug logging, but would it also make sense to use it to output some other types of log files? Some of which are XML format? Or would that be a huge WTF-in-the-making?

    If the answer is, "yes that makes sense", then the follow-up question is: how do I set up log4net so it can simultaneously log several things into different files? How do I set it up so you don't need to provide a log severity if that's not applicable?



  • Set up a syslog server and use that. <!-- :trolleybus: -->


  • Discourse touched me in a no-no place

    @blakeyrat said:

    There's also a requirement that we use log4net for the application

    @rc4 said:

    Set up a syslog server and use that.

    That doesn't seem like helpful advice--unless syslog can work with log4net.


  • Discourse touched me in a no-no place

    As far as I am aware, log4net only handles a single content stream per process (though it can simultaneously output to multiple destinations) and must have the severity metadata.

    You can do XML but it is TRWTF.

    Using it for anything but diagnostics is TRWTF.



  • Ok, so that sounds like a pretty solid, "this is a bad idea".

    I'll use Log4Net for the debug/diagnostic spew, and using my own LogManager class for the other stuff. Pity.



  • :whoosh:


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.