Hi Mark,

On 11.03.2025 09:46, Mark Thomas wrote:
On 10/03/2025 21:58, Piotr P. Karwasz wrote:

<snip/>

If you are looking for instructions on how to replace Tomcat's default logging backend with Log4j Core, there is a dedicated section[2] in our new Integrating Log4j Core with Jakarta EE Guide[3]

[2] https://logging.apache.org/log4j/2.x/jakarta.html#replace-tomcat

Thanks for this. I have added this link to Tomcat's logging documentation and it will be in the April release round.

Thanks!

If someone from the Tomcat team could review the "Integrating with Jakarta EE"[1] page, I would appreciate it. For example I would like to hear your thoughts about the log separation section[2]. Tomcat documentation says:

"Keep in mind that the alternative logging framework will need to be capable of working in an environment where different loggers with the same name may exist in different class loaders."

However these days only a few logging frameworks support separate loggers for each class loader. Logback disabled support for multiple logger contexts a couple of years ago.

The main problem is that libraries in the common classloader often use static logger fields instead of having a different logger per web application. Tomcat's own libraries seem to be an exception to this rule and each Valve uses a per-application logger, but implementations of many Jakarta specifications (e.g. Hibernate) do not follow this pattern.

It seems rather useless to fix those libraries, so my personal recommendation is to use a single logger context for the entire JVM and just add some context data to the logs.

Piotr

[1] https://logging.apache.org/log4j/2.x/jakarta.html

[2] https://logging.apache.org/log4j/2.x/jakarta.html#log-separation



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to