locked
Advice on logging RRS feed

  • Question

  • User733978539 posted

    I need to decide how I'm going to setup logging in my architecture and I'm looking at Enterprise Library's Logging block, Log4Net, or building it myself.

    Does anyone have some good advice on this? Thanks!

     

    Tuesday, January 19, 2010 2:01 PM

Answers

  • User2130758966 posted

    Thank you for the advice. I will look into that.

    Do you have any experience with Log4Net or EL logging block? 

    dont tell anyone buy I haven't ever got around to putting logging into an application yet Embarassed

    I did go so far as to doing some research into them and found this site which I think is slightly biased to promoting its own project (smartinspect) but does give a good intro to the scene:


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 19, 2010 5:04 PM

All replies

  • User2130758966 posted

    It makes sense to use a logging library because it means you dont have to write and test the code yourself.

    I have seen an article a few weeks back that uses the Facade pattern to wrap up your logging library of choice.

    That way your code isn't littered with code for a specific logging library which means you are not going to have to change your entire codebase when an alternative library comes out with a killer feature that you just gotta have! [:)]



    Tuesday, January 19, 2010 3:25 PM
  • User733978539 posted

    Thank you for the advice. I will look into that.

    Do you have any experience with Log4Net or EL logging block? 

    Tuesday, January 19, 2010 3:43 PM
  • User733978539 posted

    I noticed the last release of Log4Net was in 2006. Does anyone know if it's still being maintained? 

    Tuesday, January 19, 2010 4:47 PM
  • User2130758966 posted

    Thank you for the advice. I will look into that.

    Do you have any experience with Log4Net or EL logging block? 

    dont tell anyone buy I haven't ever got around to putting logging into an application yet Embarassed

    I did go so far as to doing some research into them and found this site which I think is slightly biased to promoting its own project (smartinspect) but does give a good intro to the scene:


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 19, 2010 5:04 PM
  • User-952121411 posted

    I noticed the last release of Log4Net was in 2006. Does anyone know if it's still being maintained? 
     

    It appears that it is an open source project with contributors, and with that type project (free) you can never expect frequent updates or fixes.  However, it may be that the product is so straight forward and stable that it has not needed any new release.  It mentions that it works on .NET Framework 2.0 and since newer frameworks are using the same CLR, it will work on them as well.  If you really wanted to use this product, you may want to contact them via the site to see the future of this project:

    http://logging.apache.org/log4net/release/features.html

     

    Wednesday, January 20, 2010 10:26 AM
  • User-26545834 posted

    log4net is a stable and actively maintained Apache project, so you shouldn't have any problems in that area. The same goes for NLog (http://nlog.codeplex.com/). However, being a co-creator of SLF (http://slf.codeplex.com), I too favor the use of a logging façade. If you want to have a look at it, the samples provide you with all the snippets you need to include logging via log4net, NLog, or EntLib in a few minutes. And if you don't care to configure logging right away, this line of code will do to get you started. With this configuration in place, all logging output will be logged to the console:

    ILogger logger = new ConsoleLogger();
    LoggerService.SetLogger(logger);


    In your code, you simply retrieve a logger and be on your way. It's as simple as it gets Smile

    ILogger logger = LoggerService.GetLogger();
    logger.Info("hello world");
    Thursday, January 21, 2010 5:33 AM