locked
Add Stack Trace in trace.log file using Enterprise library 5.0 RRS feed

  • Question

  • User1249199745 posted

    Hi,

    I am facing one issue while using trace.log file for logging the exceptions. I need to get the stack trace with other exception information. But stack trace is not available with provide enterprise library 5.0 exception logging template. Is there any way I can add this.

    Also I want to genrate seprate trace.log file for every day.

    Thanks

    Friday, May 13, 2011 4:59 AM

All replies

  • User583989486 posted

    Hi Vijarvind,

    What's your issue going now?  Do these links help in your case?

    http://www.codeproject.com/KB/aspnet/ExceptionHandling.aspx

    http://www.codeproject.com/KB/architecture/GetLoggingWithEntLib.aspx

    Best regards,

    Jonathan

    Wednesday, May 18, 2011 4:44 AM
  • User1249199745 posted

    Hi Jonathan,

    I gone through with these articles before posting my issue. They are old and doesn't solve my problem for stack trace. below is the sample of log i am able to genrate

    ----------------------------------------
    Timestamp: 10/15/2010 5:08:31 AM

    Message: Object reference not set to an instance of an object.

    Category: General, Object reference not set to an instance of an object.

    Priority: 0

    EventId: 0

    Severity: Information

    Title:

    Machine: CTL125

    App Domain: fcd4f717-3-129315928612185061

    ProcessId: 2400

    Process Name: C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\WebDev.WebServer.EXE

    Thread Name:

    Win32 ThreadId:3588

    Extended Properties:
    ----------------------------------------

    The code sample to log this is

     

     

     

     

     

     

     Public Shared Sub GetExceptionMessage(ByVal excp As Exception)

     Dim writer As LogWriter = EnterpriseLibraryContainer.Current.GetInstance(Of LogWriter)()

     Dim traceMgr As TraceManager = EnterpriseLibraryContainer.Current.GetInstance(Of TraceManager)()

     Using trace As Tracer = traceMgr.StartTrace(excp.Message)

     Dim log As LogEntry = New LogEntry

     

     End Sub

     

     

    log.Message = excp.Message

    log.Priority = 0

    writer.Write(log)

     End Using

    Thursday, May 19, 2011 1:34 AM