title: Log4J - how to log an exception caught in an imported library?
body: <p>I am a pretty new user of Log4J v. 1.2.15, as a friend of mine convinced me of the advantages over console or other forms of logging. However, as i was doing some tests, i've encountered a test case that got me thinking. Here it is what i did : </p>
  
  <ol>
  <li>I've configured the properties, added 2 appenders, a <code>ConsoleAppender</code> and a <code>RollingFileAppender</code>.</li>
  <li>I've created a new log instance, using my main class : <code>Logger mainLogger = Logger.getLogger(Main.class);</code></li>
  <li><p>I have this collection of general-purpose, hand-made, java utils, in a library, called
  <code>MyUtils.jar</code>, added to the classpath of my main app. In the main app, i've called a static method from <code>MyUtils.jar</code>. This method has a try-catch{} block and the exception was handled there, printing the stack trace, using System.err. 
  Now, using my IDE and the <code>ConsoleAppender</code>, I was able to spot the problem, however, the event was NOT logged in my file log. There are 2 problems that need answers here: 
  <strong>a.</strong> I am currently using my <code>mainLogger</code> to log events from all classes of my app. Is that a good practice? Or should i use X logger instances for X classes?
  <strong>b.</strong> What can I do to be able to log errors already caught in my imports?
  It might sounds trivial, but I've used <code>Object foo = MyLibrary.composeObjectFoo()</code>,
  and inside the method looks similar to this example : </p>
  
  <pre><code>public static Object composeObjectFoo() {
      try {
          .....statements.....
          .
          .
          //    something stupid here
          int a = 100/0; //an AritmethicException will be thrown 
      } catch Exception(e) {
          e.printStackTrace();
      }
  }
  </code></pre></li>
  </ol>
  
  <p>Thanks for your answers and please excuse the length of this...</p>
  
  <hr>