And thanks for the submission!
-Mark
On 10/26/05, Ian Reilly <[EMAIL PROTECTED]> wrote:
The attached patch for version 1.2.12 fixes two problems in org.apache.log4j.net.SyslogAppender. First, it doesn't close the writer and as a result leaks UDP sockets. Second, when logging an exception, it assumes that all lines after the first line start with a \t character. If this is not the case, it removes the first character from the line (or throws an exception if the line is empty).
Yahoo! FareChase - Search multiple travel sites in one click.
--- SyslogAppender.java.orig 2005-10-25 15:50:35.000000000 -0400
+++ SyslogAppender.java 2005-10-25 15:19:57.000000000 -0400
@@ -121,8 +121,11 @@
public
void close() {
closed = true;
- // A SyslogWriter is UDP based and needs no opening. Hence, it
- // can't be closed. We just unset the variables here.
+ try {
+ if (sqw != null) sqw.close();
+ } catch (Exception e) {
+ // ignore error
+ }
sqw = null;
}
@@ -260,7 +263,15 @@
if(len > 0) {
sqw.write(s[0]);
for(int i = 1; i < len; i++) {
- sqw.write (TAB+s[i].substring(1));
+ if (s[i].length() > 0) {
+ if (s[i].charAt(0) == '\t') {
+ sqw.write(TAB+s[i].substring(1));
+ } else {
+ sqw.write(TAB+s[i]);
+ }
+ } else {
+ sqw.write(s[i]);
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
