title: Java Write Log to Text
body: <p>Currently I'm instrumenting methods with loggers to trace some information but I have problem extracting the log output into the text file.</p>
  
  <p>What I am doing is instrumenting every single method with <code>logger.info</code> but it doesn't work when you want to add handlers because that would be adding duplicate handlers for every method. I'm now using the <code>insertBefore()</code> method from Javassist for the instrumentation part, it goes something like this:</p>
  
  <p><code>insertBefore("Loggers and some implementations");</code> - this means that loggers/implementations are done in EVERY method before it is run, which means that if I were to add handlers here there will many as many handlers with the same name as the number of methods and duplicates give me errors.</p>