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 / [email protected]

On Fri, May 19, 2017 at 2:43 PM, Michael McInness <[email protected]>
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
> [email protected]
> 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
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to