There are tons of logging frameworks out there including log4net and log4j, but the right one for you will depend on your platform and system.
The best logging techniques will depend largely on your platform and the design of your system. You need to know/decide how much information you need to diagnose a particular type of problem. Generally, you should instrument your code in a way that does not require a lot of code repetition or modification. Logging frameworks in .NET that use Attributed classes and methods are a good example of low-impact instrumentation. You should also be able to modify the level of logging (Low through Verbose) through configuration without having to shut down or restart any services.
In his interview, Mr. Blumhardt talks about building the library as a result of going through the pain of logging that we have all experienced. They talk on the show about simple logging during initial development and formalizing logging as the project matures. Good stuff and may add to the best practices knowledge base brought up in the question.
From the website:
Like other logging libraries for .NET, Serilog provides diagnostic
logging to files, the console, and so-on. It is easy to set up, has a
clean API, and is portable between recent .NET platforms.
Unlike other logging libraries for .NET, Serilog is built with
structured log data in mind. Parameters passed along with log messages
are not destructively rendered into a text format. Instead, they're
preserved as structured data that can be written in document form to a
NoSQL data store
A good article is written on this at Effective logging practices ease enterprise development.
The crux is:
See the Microsoft Enterprise Library. It includes the Logging Application Block and that documentation might be what you are looking for. You can see the MSDN Documentation without having to install the library first. Specifically, see Key Scenarios and Design of the Logging Application Block to answer your question (maybe even if you are not using .NET).
UPDATE (April 23, 2013) See Embracing Semantic Logging using the new Semantic Logging Application Block
There are tons of logging frameworks out there including log4net and log4j, but the right one for you will depend on your platform and system.
The best logging techniques will depend largely on your platform and the design of your system. You need to know/decide how much information you need to diagnose a particular type of problem. Generally, you should instrument your code in a way that does not require a lot of code repetition or modification. Logging frameworks in .NET that use Attributed classes and methods are a good example of low-impact instrumentation. You should also be able to modify the level of logging (Low through Verbose) through configuration without having to shut down or restart any services.
If you really want to dive into philosophy on the subject, try "Do Not Believe in Structured Logging" on Miloslav Trmač's blog.
"...these lessons were learned the hard way..."
Some tips :
Serilog is another structured logging solution that has become popular since the question was first asked.
In his interview, Mr. Blumhardt talks about building the library as a result of going through the pain of logging that we have all experienced. They talk on the show about simple logging during initial development and formalizing logging as the project matures. Good stuff and may add to the best practices knowledge base brought up in the question.
From the website: