简体   繁体   中英

how to configure jetty 7 to use syslog or log4j

I am looking for a way to direct all the jetty 7 logging to syslog. My current configuration dumps everything to JETTY_HOME/logs/.. After some initial ivestigation, it seems I should change JETTY_HOME/etc/jetty-logging.xml, but this does not look straightforward. It looks like I should create a new PrintStream implementation which sends its output to syslog and redirecting stderr and stdout to that class in jetty-logging.xml.

any easier way to do that or to make jetty log directly to log4j ?

Thanks

According to this advice by David Yu , it should be as simple as making org.slf4j.Logger available, which didn't work for me. However, in unix you could do something like

java ... -Djetty.home=/usr/share/jetty -Djava.io.tmpdir=/tmp \
  -jar /usr/share/jetty/start.jar /usr/share/jetty/etc/jetty.xml 2>&1 |
  logger -t jetty

In etc/jetty.xml, you may also want to comment out the line that calls RequestLogImpl.setFilename.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM