title: Getting multiple logs on one line with log4j
body: <p>I'm using org.apache.log4j.Logger and I frequently see lines in my log which look like this:</p>
  
  <pre><code>2013-06-09T00:06:00,092 data data data dat2013-06-09T00:06:10,253 data data2013-06-09T00:06:16,202 data d2013-06-09T00:06:20,750 data data data data
  </code></pre>
  
  <p>What I expect to see is: </p>
  
  <pre><code>2013-06-09T00:06:00,092 data data data data
  2013-06-09T00:06:10,253 data data data data
  2013-06-09T00:06:16,202 data data data data
  2013-06-09T00:06:20,750 data data data data
  </code></pre>
  
  <p>That is, with multiple log-lines crammed together on one line, and log information being overwritten. I've no idea what I'm doing wrong, so I'd like to know (A) if it's something obvious or (B) any pointers that can help me solve this.</p>
  
  <p>My logger class looks like this:</p>
  
  <pre><code>public class MyLogger {
      private final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger("com.example.mylog");
  
      public void info(String info){
          synchronized (log){
              log.info(info);
          }
      }
  }
  </code></pre>
  
  <p>Which I use like this:</p>
  
  <pre><code>private CallsLogger callsLogger;
  /* ... */
  myLogger.info(String.format("%s\t%s\t%s\t%s", "data", "data", "data", "data"));
  </code></pre>
  
  <p>I'm logging ~40.000 events per day, and about 200 of these have malformed lines, with anything from 2 to 11 separate events per line.</p>
  
  <p>My log4j.xml looks liks this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE log4j:configuration SYSTEM "http://logging.apache.org/log4j/docs/api/org/apache/log4j/xml/log4j.dtd"&gt;
  &lt;log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"&gt;
      &lt;appender name="mylog" class="org.apache.log4j.rolling.RollingFileAppender"&gt;
          &lt;rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"&gt;
              &lt;param name="FileNamePattern" value="logs/mylog.log.%d.gz"/&gt;
          &lt;/rollingPolicy&gt;
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern"
                     value="%d{yyyy-MM-dd'T'HH:mm:ss,SSS}\t%m%n"/&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
      &lt;logger name="com.example.mylog" additivity="false"&gt;
          &lt;level value="INFO"/&gt;
          &lt;appender-ref ref="mylog"/&gt;
      &lt;/logger&gt;
      &lt;root&gt;
          &lt;priority value="ERROR"/&gt;
          &lt;appender-ref ref="appender"/&gt;
      &lt;/root&gt;
  &lt;/log4j:configuration&gt;
  </code></pre>
  
  <p>Any help greatly appreciated.</p>