[logback-user] Messages in Syslog look corrupt through SyslogAppender

Robert Kuhar robertkuhar at gmail.com
Wed Feb 13 00:23:39 CET 2013


The plot thickens.  Somehow removing the [%thread] from the
<suffixPattern> improves the situation.

  <appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender">
    <syslogHost>localhost</syslogHost>
    <facility>LOCAL0</facility>
    <suffixPattern>%c %m</suffixPattern>
  </appender>

I no longer see random ']' characters on the syslog side corrupting
the message.  But why?  Syslog bug?  Logback bug?

On Tue, Feb 12, 2013 at 1:10 PM, Robert Kuhar <robertkuhar at gmail.com> wrote:
> I have a SyslogAppender configured to send logging messages to Syslog
> on my localhost
>
>   <appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender">
>     <syslogHost>localhost</syslogHost>
>     <facility>LOCAL0</facility>
>   </appender>
>   ...
>   <appender name="DAILY_ROLLING"
> class="ch.qos.logback.core.rolling.RollingFileAppender">
>     <File>logs/dm.log</File>
>     <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>       <FileNamePattern>logs/dm.%d{yyyyMMdd}.log</FileNamePattern>
>     </rollingPolicy>
>     <encoder>
>       <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSS} [%p] %c{2}
> DSN:%X{X-HTC-DEVICE-SN} APV:%X{X-HTC-APP-VERSION}
> RID:%X{X-HTC-REQUEST-ID} - %m%n</pattern>
>     </encoder>
>   </appender>
> ...
>   <root level="info">
>     <appender-ref ref="STDOUT" />
>     <appender-ref ref="DAILY_ROLLING" />
>     <appender-ref ref="SYSLOG" />
>   </root>
>
> The messages are making it to syslog, but the text is screwed up.  For
> example DAILY_ROLLING appender shows...
>
> 2013-02-12T12:37:58.363 [WARN] h.c.s.d.u.s.i.ProfileDataSource
> DSN:REK_20130212_1237
> APV:com.htc.cs.dm;1.0.2219283162.452657.434767;mango RID:0001 - No
> Device Profile for serialNumber: REK_20130212_1237
>
> ...but SYSLOG appender dorks it as...
>
> Feb 12 12:37:58 127.0.0.1 bobk-mbp.local [qtp763161750-30]
> htc.cs.service.device.ui.services.impl.ProfileDataSource No Device
> Profile for serialNumbe]: REK_20130212_1237
>
> .  The word "serialNumber" is presented as "serialNumbe]".  Other
> messages are dorked in a similar manner; always one character at the
> end of some word gets replaced by a ']'.  In my configuration,
> somehow, every syslog message is getting some single random character
> replaced with ']'.
>
> Where did I go wrong?  Do I have to put an <encoder> on the Appender?
> I though that without an encoder the message went straight out. Is it
> my logback configuration screwing up, or is syslog to blame?
>
> So many questions, so little time.
>
> Thanks in advance for any insights you can offer.
>
> Bob


More information about the Logback-user mailing list