How to effectively log asynchronously?

前端 未结 10 1085
无人及你
无人及你 2020-12-07 07:28

I am using Enterprise Library 4 on one of my projects for logging (and other purposes). I\'ve noticed that there is some cost to the logging that I am doing that I can miti

10条回答
  •  遥遥无期
    2020-12-07 07:55

    Just an update:

    Using enteprise library 5.0 with .NET 4.0 it can easily be done by:

    static public void LogMessageAsync(LogEntry logEntry)
    {
        Task.Factory.StartNew(() => LogMessage(logEntry)); 
    }
    

    See: http://randypaulo.wordpress.com/2011/07/28/c-enterprise-library-asynchronous-logging/

提交回复
热议问题