Logging component that produces xml logs

A lot of programs log things into a text file in a format something like this:

11/19/2008 13:29:01 DEBUG Opening connection to localhost.

11/19/2008 13:29:01 DEBUG Sending login message for user 'ADMIN'.

11/19/2008 13:29:03 DEBUG Received login response 'OK' for user 'ADMIN'.

...

However, I prefer something more structured like XML so I can parse the logs more easily. I've been doing this in my VB6 / Asp Classic programs for years and I want to do it in .Net now. Is there anything out there that will do this already or should I just re-write my VB6 code in C#?

Here is how a call to my logging component looks for my VB6 programs:

Trace.Warn "MMain", "Main(command, other data)", "Deprecated command", _
    sCommandName, sOtherData

resulting in the following log entry:

<Info time="11/17/2008 04:49:45 PM" mod="MMain" proc="Main" entry="Deprecated command" command="The_Bad_Command" other_data="The other data." />

When I want to open the log with my custom log viewer, I simply wrap the whole file in a root node, and then I can easily do this using MSXML to filter the entries that I'm seeing, find a specific user's login, etc. etc...

<Log>
...the log file text...
</Log>

Answers


I'm not sure of any products that do that, but you could use log4net and write your own appender (output handler).


Need Your Help

Filter for timezone conversion?

django django-template-filters

Simply put, I've forced my application to use UTC to make it easier on my logic when using different servers in different timezones which all write to the same database. Now, the dilemma seems to be

(How) can I use ServerSocket to listen for UDP instead of TCP traffic?

java sockets

In my application, there's a module that uses ServerSocket to listen for incoming TCP connections. When I switched a client to use UDP, I expected to receive data anyway, but I was wrong. When I lo...