You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by ht...@apache.org on 2013/01/17 23:46:00 UTC

svn commit: r1434946 - in /openjpa/branches/2.2.1.x: ./ openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java

Author: hthomann
Date: Thu Jan 17 22:45:47 2013
New Revision: 1434946

URL: http://svn.apache.org/viewvc?rev=1434946&view=rev
Log:
OPENJPA-2321: Synchronizing logging output stream causes deadlock when used some JDK LogManger derivative - back ported to 2.2.1.x Pinaki's trunk changes.

Modified:
    openjpa/branches/2.2.1.x/   (props changed)
    openjpa/branches/2.2.1.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java

Propchange: openjpa/branches/2.2.1.x/
------------------------------------------------------------------------------
  Merged /openjpa/trunk:r1431649

Modified: openjpa/branches/2.2.1.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.1.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java?rev=1434946&r1=1434945&r2=1434946&view=diff
==============================================================================
--- openjpa/branches/2.2.1.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java (original)
+++ openjpa/branches/2.2.1.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/log/LogFactoryImpl.java Thu Jan 17 22:45:47 2013
@@ -302,24 +302,21 @@ public class LogFactoryImpl 
 
         protected void log(short level, String message, Throwable t) {
             String msg = formatMessage(level, message, t);
-            synchronized (_out) {
-                _out.print(msg);
-            }
+            _out.println(msg);
         }
 
         /**
          * Convert <code>message</code> into a string ready to be written to
-         * the log. The string should include the terminating newline.
+         * the log. 
          *
          * @param t may be null
          */
-        protected String formatMessage(short level, String message,
-            Throwable t) {
+        protected String formatMessage(short level, String message, Throwable t) {
             // we write to a StringBuilder and then flush it all at
             // once as a single line, since some environments(e.g., JBoss)
             // override the System output stream to flush any calls
             // to write without regard to line breaks, making the
-            // output incomprehensibe.
+            // output incomprehensible.
             StringBuilder buf = new StringBuilder();
 
             buf.append(getOffset());
@@ -335,7 +332,6 @@ public class LogFactoryImpl 
             buf.append(_channel);
             buf.append(" - ");
             buf.append(message);
-            buf.append(NEWLINE);
 
             if (t != null) {
                 StringWriter swriter = new StringWriter();