views:

377

answers:

1

I'm wondering if its - a) possible; b) good practice - to log multiple applications to single log instance?

I have several ASP.NET apps and I would like to aggregate all exceptions to a centralized location that can be queried as part of an Enterprise Dashboard app. I'm using both the EL logging block and the EL exception blog along with the Database Trace Listener. I would like to see exceptions across all apps logged to a single db.

Any comments, best practice guidelines or answers would be extremely welcome.

+3  A: 

Yes, it is definitely possible to store multiple application logs in a central location using EL.

An Enterprise Dashboard application that lets you view exceptions across applications and tiers, and provides reporting is a great reason to centralize your logging. So I'll say yes to question b as well.

Possible Issues/Negatives

I'm assuming that you are using the Database Trace Listener since you mention that in your question. If there are a large number of applications logging a large number of log entries combined with users querying the (potentially large) log database, there is the potential for performance to degrade (since the logging is done synchronously) which could impact your application performance.

Another Approach

To mitigate against this possibility, I would investigate using the Distributor Service to log asynchronously. In that model, all of the applications would log to a message queue (using the MSMQ Trace Listener). A separate service then polls the queue and would forward the log entries to a trace listener (in your case a Database Trace Listener) which would persist the messages in your dashboard database. This setup is more complicated. But it does seem to align with what you are trying to achieve and has some other benefits such as asynchronous processing and the ability to log even if the dashboard database is down (e.g. for maintenance).

Other Considerations

You may also want to think about standardizing some LogEntry properties across applications. For example, LogEntry doesn't really have an "application" property so you could add an ExtendedProperty to represent the application name. Or you may standardize on a specific format for the Message property so that various information can be pulled out of the message and stored in separate database columns for easier searching and categorization.

Tuzo
Yes I'm using the Database Trace Listener. One of the first apps to use it is about to be refactored to use MSMQ so I can take that experience and apply it to my logging. Thanks for bringing the Distributer Service and ExtendedProperty(ies) to my attention too. And thanks for helping out a fellow Torontonian :)
tforster