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.