Logback - Multiple syslog appenders -


i'm logging syslog syslog appender shown below:

<appender name="syslog" class="ch.qos.logback.classic.net.syslogappender">         <sysloghost>localhost</sysloghost>         <facility>local6</facility>         <suffixpattern>app: %logger{20} %msg</suffixpattern>     </appender> 

but i've got new requirement want send logs "local5" facility instead of local6. i've read logback configuration documentation http://logback.qos.ch/manual/configuration.html i'm still not sure how this.

you can use 2 syslog appenders 1 local6 , other local5

<appender name="syslog" class="ch.qos.logback.classic.net.syslogappender">         <sysloghost>localhost</sysloghost>         <facility>local6</facility>         <suffixpattern>app: %logger{20} %msg</suffixpattern>     </appender>   <appender name="syslog1" class="ch.qos.logback.classic.net.syslogappender">         <sysloghost>localhost</sysloghost>         <facility>local5</facility>         <suffixpattern>app: %logger{20} %msg</suffixpattern>     </appender> 

advantage customize logs( logs) using filters, pattern, logger names etc. , syslogappender extends unsyncronizedappender.

reason being cannot use single appender method facilitystringtoint(string facilitystr) in class syslogappender.java accepts string compares standard facility using equals. example

     if ("kern".equalsignorecase(facilitystr)) {           return syslogconstants.log_kern;      } 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -