Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Logging to a File in Jetty Embedded

On Thu, Feb 13, 2025 at 9:55 AM Michael B Allen <ioplex@xxxxxxxxx> wrote:
I have a working Jetty 12 embedded app built with maven and a src/main/resources/jetty-logging.properties with org.eclipse.jetty.LEVEL=DEBUG which works.
DEBUG messages are successfully logged to the console.

But now, how do I direct all log messages to a file logs/jetty.log?

I've been looking at Jetty 12 embedded/logging examples but it's still not clear what I need to do.

I've tried adding a maven dep for slf4j-simple and added org.slf4j.simpleLogger.logFile=logs/jetty.log to jetty-
logging.properties.

I've tried adding a dep for logback-classic and a src/main/resources/logback.xml referencing logs/jetty.log.
 
Everything I've tried has zero effect.

Normally I would deep dive into code but there's so many layers of indirection I would be laughing if I wasn't crying.

Can someone give me a vague idea of the linkages involved in getting a Jetty 12 embedded app to write everything to a disk file?

I managed to get logback-classic to work.

Not sure why it didn't before. Maybe I had both jetty-slf4j-impl and logback-classic in the pom when you can have only one implementation jar.

Mike
 
--
Michael B Allen
Java AD DS Integration
https://www.ioplex.com/

Back to the top