Shilpa: Without proper planning and clear strategy, the log messages produced by the system may not be useful for problem resolution.Effective logging is a balance between logging enough data to debug problems, while not dumping so much it confuses the issue.
Shilpa: Without proper planning and clear strategy, the log messages produced by the system may not be useful for problem resolution.Effective logging is a balance between logging enough data to debug problems, while not dumping so much it confuses the issue.
Both Log4net and Nlog are open source, free libraries. Well-used and well-loved, mature technologies, that are known to work very well. No option to buy corporate support, but there is plenty of free support from the user community available online.
While I prefer to log to a file: More flexibility to change what is being loggedLogging doesn’t compete with the application for DB connectionsDB access is broken more often than file accessWhy you may choose to log to the DB: Easier to parse logsIt is possible to use Aspects to separate logging concerns from the application logic - for logs that are stable. If you use logging to trace problems as the application is being developed and maintained – putting logs with the code is simpler and helps to shorted the development cycle.
While I prefer to log to a file: More flexibility to change what is being loggedLogging doesn’t compete with the application for DB connectionsDB access is broken more often than file accessWhy you may choose to log to the DB: Easier to parse logsIt is possible to use Aspects to separate logging concerns from the application logic - for logs that are stable. If you use logging to trace problems as the application is being developed and maintained – putting logs with the code is simpler and helps to shorted the development cycle.
Go back to examples
Go back to examples
Unless step 1 or step 2 throw, we already know both will happen – no need to log the second.When putting loggin inside a loop, it’s helpful to record loop counter and the item being processed.
It is important that logs are dense with information. If logging an object with no ToString method, it’s full type name will be printed – bad.Frameworks provide a way to post file and line from where logging is done – no need to do it in text.
Shilpa: Without proper planning and clear strategy, the log messages produced by the system may not be useful for problem resolution.Effective logging is a balance between logging enough data to debug problems, while not dumping so much it confuses the issue.
How to handle large log files,e.g Roll the files.... (zip them up after certain days etc....)
A rare bug is harder to trace – and usually presents less of a problem to the business. When arbitraging future work, use logs to learn what users want.