My.Application.Log.WriteEntry Is Cool, But Formated Information SUCKS

  • Thread starter Thread starter Dachshund Digital
  • Start date Start date
D

Dachshund Digital

Has any one figured out how to override the WriteEntry or show change
the actual output?

I am sorry, but putting the DATE/TIME PROCESS # and Thread #
information AFTER the 'Message' text just sucks and makes it horrible
for human readability.

For example...

DefaultSource Information 0 This is a message 2006-05-13
18:21:58Z 472 10

Should be...

2006-05-13 18:21:58Z DefaultSource Information 0 472 10 This is a
message

What brain dead decision was made to put the VARIABLE sized data in the
MIDDLE of the standard formatting?

And, the inability to remove the SOURCE and SWITCH information? Like
any user will have a clue. We have no end of customers using our code
that GRIPE about this CRAPPY formatting. We may have to go back to our
custom Trace Listener, which sucks too, because the
My.Application.Log.WriteEntry is SO EASY to use.
 
I would use this sub below. you can create your own event log on the
pc.

Public Shared Sub LogErrorToLocalEventLog(ByVal ex As Exception)


' Create the source, if it does not already exist.

Dim myLogName As String = "Name Event Log here"

If Not EventLog.SourceExists(ERROR_SOURCE) Then

EventLog.CreateEventSource(ERROR_SOURCE, myLogName)

Else

myLogName =
EventLog.LogNameFromSourceName(ERROR_SOURCE, ".")

End If

' Create an EventLog and assign source.

Dim myEventLog As New EventLog

myEventLog.Source = ERROR_SOURCE

myEventLog.Log = myLogName

' Set the 'description' for the event.

Dim myEventLogEntryType As EventLogEntryType =
EventLogEntryType.Warning

Dim myApplicatinEventId As Integer = 1100

Dim myApplicatinCategoryId As Short = 1

' Write the entry in the event log.

myEventLog.WriteEntry(ex.Message & vbCrLf & ex.StackTrace,
myEventLogEntryType, myApplicatinEventId, myApplicatinCategoryId)

End Sub
 
This is a good example, thanks, and I could do it and have done such in
the past. But it does not address my question... I want to use
My.Application.Log.WriteEntry() but force the output of the method to a
format that makes sense to a human, Microsoft' s formatting options are
horrible, and so inflexible that it is reporting that I would NEVER let
my clients see. Just that bad.
 
This is a good example, thanks, and I could do it and have done such in
the past. But it does not address my question... I want to use
My.Application.Log.WriteEntry() but force the output of the method to a
format that makes sense to a human, Microsoft' s formatting options are
horrible, and so inflexible that it is reporting that I would NEVER let
my clients see. Just that bad.
 
Back
Top