title: Log4j Async appender usage?
body: <p>I am using log4j <code>AsyncAppender</code>. i wrote my own appender to customise the logger as below.</p>
  
  <p>public class MyAppender extends AppenderSkeleton {</p>
  
  <pre><code>@Override
  public void close() {
  
  }
  
  
  @Override
  public boolean requiresLayout() {
      return false;
  }
  
  
  @Override
  protected void append(LoggingEvent event) {
  
  //Here am doing some logic which will connect database and fetch some records.  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <h2>My log4j configuration:</h2>
  
  <pre><code>&lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"&gt;
  
      &lt;!-- Appenders --&gt;
  
      &lt;appender name="stdout" class="com.sample.MyAppender"&gt;
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern" value="%d %p [%c] - %m%n"/&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
  
      &lt;appender name="ASYNC" class="org.apache.log4j.AsyncAppender"&gt;
          &lt;param name="BufferSize" value="500"/&gt;
          &lt;appender-ref ref="stdout"/&gt;
      &lt;/appender&gt;
  
  
      &lt;root&gt;
          &lt;level value="INFO" /&gt;
          &lt;appender-ref ref="ASYNC" /&gt;
      &lt;/root&gt;
  
  &lt;/log4j:configuration&gt;
  </code></pre>
  
  <p>Now everything works fine. Im <code>MyAppender</code> i will fire a <code>Select</code> query and fetch some details from the table and send those details using java mail API.  As i am using <code>AsyncAppender</code>, it does not block existing running thread and the MyAppender logic is executed Asynchronously.My question is if the main thread completes its execution before <code>MyAppender</code> logic gets completed then is there any guarantee that the logic in <code>MyAppender</code> will be completed even if main thread completes its execution?</p>
  
  <p>Thanks!</p>