Alex Rivera | Logout

What should I log in production app

Asked 2010-02-08T16:22:27.023
14

I'm starting up a new project and am thinking of what things I should be logging. The logfile is only intended to help developers find bugs. The use case is that when an unhandled exception is thrown a notification is send to the developer, who have access to the logfile and stacktrace.

What things should I include in the logfile? Logging everything isn't going to work. I know it's difficult to say, as the answer probably requires deep knowledge about the system. So I guess I'm really asking for "best practices". Please give specific examples.

Also does it depends on the application type such as desktop client application, desktop server or a webserver?

Edit
Report

1 Answer

0

Logging is your Saviour when it comes to "all hell broke loose" situation in production. As you said it does require more knowledge of the application but over all your should think about couple of things.

  1. Log every exception and errors. Nothing should escape.
  2. Consider logging user login and logout action. This is a good info to have to monitor your application for malicious attacks and stuff.
  3. You can surly not log every method but you if the system is designed right and if you have single point of entry for your communication between n layers then you can log that method. i.e. Save , Delete , Update methods etc.
  4. Also provide some logging inside if#debug code so that you can turn the debugging on in production and produce more logging if needed. This is very helpful specially while working in dev environment and debugging production database.
answered 2010-02-08T19:29:06.783

Your Answer