logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carn...@apache.org
Subject svn commit: r732771 - in /logging/log4j/trunk/src: changes/changes.xml main/java/org/apache/log4j/net/SyslogAppender.java
Date Thu, 08 Jan 2009 17:47:41 GMT
Author: carnold
Date: Thu Jan  8 09:47:40 2009
New Revision: 732771

URL: http://svn.apache.org/viewvc?rev=732771&view=rev
Log:
Bug 46271: SyslogAppender.appender throws exception if layout is not set

Modified:
    logging/log4j/trunk/src/changes/changes.xml
    logging/log4j/trunk/src/main/java/org/apache/log4j/net/SyslogAppender.java

Modified: logging/log4j/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/changes/changes.xml?rev=732771&r1=732770&r2=732771&view=diff
==============================================================================
--- logging/log4j/trunk/src/changes/changes.xml (original)
+++ logging/log4j/trunk/src/changes/changes.xml Thu Jan  8 09:47:40 2009
@@ -69,6 +69,7 @@
        <action action="add" issue="45990">Add replyTo attribute to SMTPAppender</action>
        <action action="fix" issue="44644">SMTPAppender does not properly encode subject
or content containing non-ASCII characters.</action>
        <action action="fix" issue="46388">Clarify javadoc of Layout.ignoresThrowable.</action>
+       <action action="fix" issue="46271">SyslogAppender.append throws exception if
layout is not set.</action>
     </release>
 
   

Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/net/SyslogAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/net/SyslogAppender.java?rev=732771&r1=732770&r2=732771&view=diff
==============================================================================
--- logging/log4j/trunk/src/main/java/org/apache/log4j/net/SyslogAppender.java (original)
+++ logging/log4j/trunk/src/main/java/org/apache/log4j/net/SyslogAppender.java Thu Jan  8
09:47:40 2009
@@ -313,7 +313,12 @@
     }
 
     String hdr = getPacketHeader(event.timeStamp);
-    String packet = layout.format(event);
+    String packet;
+    if (layout == null) {
+        packet = String.valueOf(event.getMessage());
+    } else {
+        packet = layout.format(event);
+    }
     if(facilityPrinting || hdr.length() > 0) {
         StringBuffer buf = new StringBuffer(hdr);
         if(facilityPrinting) {
@@ -333,7 +338,7 @@
         sqw.write(packet);
     }
 
-    if (layout.ignoresThrowable()) {
+    if (layout == null || layout.ignoresThrowable()) {
       String[] s = event.getThrowableStrRep();
       if (s != null) {
         for(int i = 0; i < s.length; i++) {



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message