locked
Logging Application Block to event viewer RRS feed

  • Question

  • I use this simple code to log exception in event viwer - but it's not written in Event Viewer.
    Anuy idea where I am going wrong

     

                        LogEntry _logentry = new LogEntry();
                        _logentry.Categories.Add("EventLogCategory");
                        _logentry.Priority = 2;
                        _logentry.EventId = 4000;
                        _logentry.Severity = TraceEventType.Information;
                        _logentry.Title = "My Title";
                        _logentry.Message = "Message from Log Entry Object";
                        Logger.Write(_logentry);
                        Logger.Write("This is being written to text file", "DebugCategory", 2, 2000, TraceEventType.Information, "My method");   

    and

    <

     

    listeners>

    <

     

    add source="Enterprise Library Logging" formatter="Text Formatter" log="Test_2"

     

     

    machineName="XXX" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

     

     

    traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

     

     

    name="Formatted EventLog TraceListener" />

    </

     

    listeners>

    is the Enterprise Library Config file.

    When I debugg i can see the _logentry object has all the values from but its not written in eventviwer

    Thursday, July 23, 2009 9:55 AM

Answers

  • Discuss on http://entlib.codeplex.com/Thread/List.aspx

    Please mark the post answered your question as the answer, and click the chartreuse pyramid floating over "Vote as helpful" to mark other helpful posts as helpful. This posting is provided "AS IS" with no warranties, and confers no rights.
    Visual C++ MVP
    Thursday, July 23, 2009 12:53 PM