title: Asynchronous Logging
body: <p>Right now in my application,at certain points we are logging some heavy stuff into the log files.</p>
  
  <p>Basically only for logging we are creating JSON of the data available and then logging into Log files.This is business requirement to log data in JSON format .</p>
  
  <p>Now creating JSON from the data available and then logging to FILE takes lot of time and impacts the original request return time.
  Now idea is to improve the sitation .</p>
  
  <p>One of the things that we have discussed is to create a thread pool using</p>
  
  <pre><code>Executors.newSingleThreadExecutor() 
  </code></pre>
  
  <p>in our code and then submitting the task to it which does the  conversion of data into JSON and subsequent logging.</p>
  
  <p>Is it a good approach to do this ?As we are managing the thread pool itself ,is it going to create some issues?</p>
  
  <p>I would appreciate if someone can share better solutions.
  Someway to use Log4j for this .I tried to use AsyncAppender but didnt achieve any desired result.
  We are using EJB 3,Jboss 5.0,Log4j,java6.</p>