Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends ,

My client has using Microsoft.Practices.EnterpriseLibrary.Logging dll for write Log. I don't know why? Can u anyone explain about the feature of Microsoft.Practices.EnterpriseLibrary.Logging Compare to normal logging using EventLog.

It's my client code for using enter log.
C#
public void LogData(string strMessage, TraceEventType enmEventType)
{
    CreateMyLog();
    LogEntry objLog = new LogEntry();
    objLog.Message = strMessage;
    objLog.Categories.Add("General");
    objLog.Severity = enmEventType;
    Logger.Write(objLog);
}

public void CreateMyLog()
{
    if (!EventLog.SourceExists("SourceName"))
    {
        EventLog.CreateEventSource("SourceName", "SourceName");
    }
}

And also this code was not working in my environment It's throw a error when execute the following line
Logger.Write(objLog);
I had use google but no answer found for me. Can anyone help me. Your help is much appreciate.

Thanks for Advance.
Posted
v2
Comments
Vedat Ozan Oner 15-Feb-14 12:38pm    
you can look at this page:

http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog%28v=vs.110%29.aspx

there is a good example at the end of the page. and please read it all documentation, I think you can find the solution for that exception.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900