Logaback version 1.3.0 uses Javax-Servlet version 4.0.1.
In the same application, I am using Jetty 9.4.50, which uses javax-servlet 3.1.0.
When I load logback.xml locally, my application works successfully.
If I start the application through the Jetty server, no logs are generated
( logback.xml file cannot be loaded by the Jetty server).
According to my understanding, Logback and Jetty have the same Javax-servlet version
Could you please tell me why my logs are not generated?
First, and most important, Jetty 9.x is now at End of Community Support.
See announcement at https://github.com/eclipse/jetty.project/issues/7958
You should be using Jetty 10+ now.
For Logback, you cannot use Logback 1.3.x on Jetty 9.x
That's because it requires Servlet 4.0.1, which is available on Jetty 10+ (not Jetty 9)
For Jetty 9.x you should stick with Logback 1.2.x, but that also means you are stuck with all of the Hanging / Blocked Thread / Async / 100% CPU bugs that logback hasn't fixed in Logback 1.2.x (many were fixed in Logback 1.3.x, and a lot more were fixed in Logback 1.4.x).
The breakdown of Logback to Servlet to Jetty
Logback | Servlet | Namespace | Jetty |
---|---|---|---|
1.2.x | Servlet 3.1.x | javax.servlet |
Jetty 9.x |
1.3.x | Servlet 4.0.x | javax.servlet |
Jetty 10.x |
1.4.x | Servlet 5.0.x | jakarta.servlet |
Jetty 11.x |