This is a rolling this that I keep with things that need to be in every software project, along with conditions and the WHY of having them.
This is a total must have. You need to log all exceptions/errors and additionally, it’s good to log information about the current user flow. This will help you in identifying customer issues post-release but also in day-to-day development.
You need to incorporate logging from day 1. Don’t wait for it.
Watch out for:
- cost of logging – when you log you want to log information about what was already evaluated, you don’t want to evaluate things just to log them, that’s expensive. Also, you don’t want to go to a database to get something just to log it so beware of logging objects that come from an ORM.
- I/O cost – the more you log, the more I/O you do, use logging frameworks that are I/O efficient and use IsDebugEnabled/IsInfoEnabled where appropriate
- storage costs – do rollover your logs. also, use a framework that allows you to do log rollover with gzip for storage saving. logs can and will fill disks
My favorites: https://www.slf4j.org/ for Java, http://nlog-project.org/ for .Net , Logger for ruby
2. Localization / Internationalization
Read this: Building software that speaks their language
3. Custom error pages (or messages)
If you are building a web application you’ll want to have custom error pages. You should add these in from the start, as the base of your application. This creates a more manageable way to recover from errors for your users, plus it gives you a way to instruct the users on what they can do to return to a normal state OR a way for them to notify you that something broke.
Include a 404 page as well.
If you are not building a web application, include custom error messages or prompts.
Remember, this is not a log file and it is intended to be read and understood by users, not you.