[logback-dev] svn commit: r1904 - logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net

noreply.ceki at qos.ch noreply.ceki at qos.ch
Wed Oct 29 16:59:16 CET 2008


Author: ceki
Date: Wed Oct 29 16:59:16 2008
New Revision: 1904

Modified:
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java

Log:
LBCLASSIC-57

Setting a message size limit of 256K.

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java	Wed Oct 29 16:59:16 2008
@@ -28,6 +28,7 @@
 public abstract class SyslogAppenderBase<E> extends AppenderBase<E> {
 
   final static String SYSLOG_LAYOUT_URL = CoreGlobal.CODES_URL + "#syslog_layout";
+  final static int MSG_SIZE_LIMIT = 256*1024;
   
   Layout<E> layout;
   int facility;
@@ -77,6 +78,9 @@
 
     try {
       String msg = layout.doLayout(eventObject);
+      if(msg != null && msg.length() > MSG_SIZE_LIMIT) {
+        msg = msg.substring(0, MSG_SIZE_LIMIT);
+      }
       sw.write(msg);
       sw.flush();
       postProcess(eventObject, sw);


More information about the logback-dev mailing list