Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Event Log vs Text Logs

I'm hoping to get some definitive answers on this great question. When writing web applications in .net, should you use the append feature in the IIS access log to store what you want or should you write to the windows event log?

I'm talking about informational logging, warning logging and error logging. Would it be smart to split it up and write to both the iis log and event log?

Or for that matter for normal .net windows applications, should they write to their own log file or use the event log?

like image 924
Elvar Avatar asked Feb 06 '12 09:02

Elvar


1 Answers

I would advice you to not put your application specific log information in the IIs log file. That log file is specific to the web server and the format of that log file is determined by the log settings in IIs. 3rd party log analyzing tools are available for it, and you may ending up in a situation where these tools can not parse the IIs log files because information you have put there could be mis-formatted.

Application specific log information is better to separate into either the Event log or a dedicated log file. Whether it should be the Event log or not is really a matter of preference. The Event log information could more easily be parsed and filtered by the Event Viewer and therefore could be much easier to deal with. It's a well known format that you can send to other people for further investigation and they can easily load that up into their Event Viewer. Excellent choice for support cases. If you expect a log of loggin it's preferable to create dedicated application specific Event log so you don't clutter the generic Application Event log.

I would say that this is true for Windows desktop applications as well.

If you don't already, I would also recommend you to use one of the well known logging frameworks such as Log4Net or the Enterprise Logging Block. It will save you a lot of time and pain.

like image 112
Magnus Johansson Avatar answered Sep 21 '22 21:09

Magnus Johansson