Singleton logger, static logger, factory logger… how to log?

后端 未结 3 1101
南方客
南方客 2021-02-08 12:21

I am wrapping the patterns & practices Enterprise Library Logging Application Block for an application written in .NET.

I want to be able to subclass a logger (i.e t

3条回答
  •  一生所求
    2021-02-08 12:58

    Also, checkout log4net. I never found the EL's logging to be as flexible as log4net. I chose log4net since I was already familiar with using log4j.

    protected readonly log4net.ILog LOG = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
    

    Doing it this way, I can get logs like this:

    2009-07-15 09:48:51,674 [4420] DEBUG SampleNamespace.SampleClass [(null)] - Sample message you want to output

提交回复
热议问题