Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Servlet log4j not using jetty rootLogger

That is doing exactly as documented.
Logging the server to log4j.

Your webapp is classloader isolated, you'll need to either use something that can capture/route all logging events from all logging frameworks (like slf4j + logback) or setup your logging for each webapp specifically in that webapp.


Joakim Erdfelt / joakim@xxxxxxxxxxx

On Fri, Oct 9, 2015 at 3:16 AM, Bill Ross <ross@xxxxxxxxxxxx> wrote:
While developing I have enjoyed stderr logging. Now I need to log to file, so I followed

  http://www.eclipse.org/jetty/documentation/current/example-logging-log4j.html

And with this jetty-base/resources/log4j.properties

log4j.rootLogger=info, A1
log4j.additivity.FileLog=false
log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.File=/home/priot/ops/jetty-base/logs/jetty.log
log4j.appender.A1.MaxFileSize=1MB
# log4j.appender.A1.MaxBackupIndex=1
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

now jetty is logging to the indicated file. But my Servlets are still logging to console. There is no log4j config in the war file - is there some way to make the Servlets inherit the rootLogger of the container? E.g. I don't want to embed the log file path in my war since I'll run in different environments.

Thanks,
Bill
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top