I have been told to add “logging” to my code using log4net, the problem is no one can travel in time and see what real world problems the logging will need to be used to solve.<
Logging is not an easy task, but my experience is that all logs should be searchable for responsible parties. An useful target for errors are email directly (and in some cases sms). But in the end all logging data should be searchable in a database with a sesible user interface.
When the email is received to a specific account, this can be processed and put in the database directly. There are som categories and handling rules below:
The content of the debugging can be written to the database in different way, but we need to concider performance. Large amount of data should not be written to database in "production mode". This should be done in daily/weekly bases. The best way is to produce a local file (such as XML or plain text) and put this file into the database during maintenance hours (at night). It should be possible to start/stop a debug session and only write the debug information to the database when the debug session is completed.
The debug component could be implemented as a WCF and log2net and directy access to the database and/or a local file store that is put into the database on regular basis.
One thing is clear...ALL errors/exception should be logged somewhere. Nothing is more irritating than lost error messages :)
Happy debugging!