Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Inconsistent logging behavior

If you do have logging configured in the webapp, it may be that you actually have multiple copies of logging and that they are overwriting each other's files, hence the missing logs. 

If you want logging configured per webapp then make sure each webapp has a different destination file, which is also different to jetty's. 

If you are using the Jetty log modules,  then the logging jars should be hidden from the Web app any way and you will have to provide your own jars. 

Prior versions of jetty did not hide the logging jars and could explain the change in behaviour. 



On 19 May 2017 23:53, "Joakim Erdfelt" <joakim@xxxxxxxxxxx> wrote:
If you want 1 log file per webapp, you'll have to configure that logging in the webapp context itself.
Each webapp will have its own log4j jars, and its own log4j.properties.

You have configured Server logging, and that will log everything on the server side to a single log4j configuration.


Joakim Erdfelt / joakim@xxxxxxxxxxx

On Fri, May 19, 2017 at 2:43 PM, Michael McInness <m.mcinness1@xxxxxxxxx> wrote:
I'm using jetty (9.4.4) purely as a servlet container and have logging configured to use log4j. I configure logging as such:

jetty@foo:/opt/jetty-base/modules$ curl -O https://raw.githubusercontent.com/jetty-project/logging-modules/master/log4j-1.2/logging.mod

jetty@foo:/opt/jetty-base/modules$ cd ..

jetty@foo:/opt/jetty-base$ java -jar /opt/jetty/start.jar --add-to-start=logging

then I copy the log4j properties file below to

/opt/jetty-base/resources/


log4j.properties:


log4j.rootLogger=out


log4j.appender.out=org.apache.log4j.RollingFileAppender

log4j.appender.out.layout=org.apache.log4j.PatternLayout

log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n

log4j.appender.out.file=/opt/jetty-base/logs/jetty.log

log4j.appender.out.append=true

log4j.appender.out.maxFileSize=10MB

log4j.appender.out.maxBackupIndex=30

It works pretty well, but periodically I notice that, when I have multiple wars deployed, logging from one or the other disappears. After I restart jetty, everything is logged again for a while.

I am looking for guidance on how to configure jetty's logging to be bullet-proof and ideally, I'd like to have one log file per webapp.

Thanks in advance.

_______________________________________________
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


_______________________________________________
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