title: Logging in Java and in general: Best Practices?
body: <p>Sometimes when I see my logging code I wonder if I am doing it right. There might be no definitive answer to that, but I have the following concerns:</p>
  
  <p><strong>Library Classes</strong></p>
  
  <p>I have several library classes which might log some <code>INFO</code> messages. Fatal Errors are reported as exceptions. Currently I have a static logger instance in my classes with the class name as the logging name. (Log4j's: <code>Logger.getLogger(MyClass.class)</code>)</p>
  
  <p>Is this the right way? Maybe the user of this library class doesn't want any messages from my implementation or wants to redirect them to an application specific log. Should I allow the user to set a logger from the "outside world"? How do you handle such cases?</p>
  
  <p><strong>General logs</strong></p>
  
  <p>In some applications my classes might want to write a log message to a specific log not identified by the class' name. (I.e.: <code>HTTP Request log</code>) What is the best way to do such a thing? A lookup service comes to mind...</p>