Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practices for logging on top of logging levels

Tags:

logging

Generally, log levels can be switched to get different level of detailed logs. Usually a lowest level of log often can help one to identify which area of the codes could be wrong. To further debug, one usually increases the debug level to get more information. However, this results in unnecessary large amount of logs that is not related to the problem.

The quest is: what are the best practices on this issue? define another dimension of logs? By logic area, methods or else?

EDIT: This comes from a real project where the application deployed on customer environment and when things go wrong, the log is the thing they send in for debugging, definitely they will hate sending large amount of logs, or do the analysis/parsing themselves: usually they are non-technical customers. I guess this is related to the question of how to manager the logging efficiency in this situation. Please leave comment if opening another thread is more proper. Thanks.

like image 706
Dr. Xray Avatar asked Dec 10 '09 05:12

Dr. Xray


1 Answers

You could use different listeners for different parts of your application. But probably the best thing you could use is the Microsoft Log Parser which gives you the ability to run queries over your log file, e.g. you can do a SELECT on the data within a text log file. Check it out, it really is quite a powerful tool.

like image 67
slugster Avatar answered Oct 16 '22 14:10

slugster