[logback-user] Specifying SYSLOGTAG portion of syslog message using SyslogAppende

Pradnya Gawade pradnya.gawade7 at gmail.com
Thu Jan 6 17:10:01 CET 2011


I had same question in past and following worked for me.
I did not find property of syslog appender where TAG can be specified.
Formatting the message with square bracket in it containing the text
you want to put as TAG can do the job. e.g. you can configure your
Syslog appender as:

<appender name="SYSLOG-USER"
class="ch.qos.logback.classic.net.SyslogAppender">
		<SyslogHost>${syslog.host}</SyslogHost>
		<port>${syslog.port}</port>
		<Facility>USER</Facility>
		<SuffixPattern>[ABC]  %logger %msg</SuffixPattern>
</appender>

In this case 'ABC' should show up as TAG in the Syslog message. You
can substitute this value dynamically from MDC context or properties
file. In case you want to substitute it from MDC context, you can use
some thing like:
 <SuffixPattern>[%mdc{ABC}]  %logger %msg</SuffixPattern>


Thanks,
Pradnya






On Thu, Jan 6, 2011 at 10:25 AM, Sujith Sukumaran <sukumsu at ymail.com> wrote:
>
>  How can users specify the tag portion of a syslog message using the
> SyslogAppender. Is there a tag property on the SyslogAppender ?.
> So, if message is logged it would automatically prefix the message with the
> tag.
>
> Regards,
> Sujith
>
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
>
>


More information about the Logback-user mailing list