Getting tomcat to register webapp name in registration reports

Using the tomcat JULI log (jdk logging extension) allows you to retrieve log instructions to include the webapp context path (for example, / myapp). I have the same webapp that has been deployed several times with various configuration options in web.xml. It would be very helpful to understand which webapp was spitting out which log entries.

Currently, the output of the magazine is as follows:

Feb 22, 2012 9:37:57 AM org.mypackage.MyClass init INFO: Model has been initialized Feb 22, 2012 9:37:57 AM org.mypackage.MyClass init INFO: after loading model: 1329921477445 

I would like to include the webapp context path (or web app name) to the class name. Something like that:

 Feb 22, 2012 9:37:57 AM /mywebapp org.mypackage.MyClass init INFO: Model has been initialized Feb 22, 2012 9:37:57 AM /mywebapp org.mypackage.MyClass init INFO: after loading model: 1329921477445 

Thanks Matt

+4
source share
1 answer

Use SLF4J and Logback in your web applications. Do not rely on Java Logging (JULI).

0
source

Source: https://habr.com/ru/post/1397834/


All Articles