Hi, I'm using log4j package(Version is 1.2.1) in project. As Happen, when I used SyslogAppender and SyslogWriter for syslogd. Written word is unperfectly to syslogd's "messages" file. This word is so short than I expect that. I thought, it's a enviroment problem with unicode. Because I use log4j on multibyte enviroment. (Spec:Fujitsu Solalis SunBlade 1000) Then, I read log4j package's sources. I detected un-appropiate codes. Next code is referd for "SyslogWriter.java". > public > void write(String string) throws IOException { > DatagramPacket packet = new DatagramPacket(string.getBytes(), > string.length(), > address, SYSLOG_PORT); > > if(this.ds != null) > ds.send(packet); > > } "DatagramPacket()" 's second parameter is "string.length()". But I thought. This suitable code is "string.getBytes().length".
Mr. Kadota, You are absolutely right. The computation of the byte array length is wrong. Just fixed in CVS. The fix will be available in log4j 1.2.3 when that is released. Thank you for the very professionnal bug report. -- Ceki
Mr.Ceki, I appreciate your quickly response. Thank you.