Alternative to CLASSPATH for ecs-logging-core.jar and jul-ecs-formatter.jar with Tomcat

Tomcat 9.0.52
Java openjdk version "1.8.0_302"
Linux

As per the suggestion (Get started | ECS Logging Java Reference [1.x] | Elastic) I have been successfully using ecs-logging-core.jar and jul-ecs-formatter.jar by adding them to the CLASSPATH environment variable in tomcat/bin/setenv.sh:

export CLASSPATH="$CLASSPATH:/usr/local/tomcat/bin/ecs-logging-core.jar:/usr/local/tomcat/bin/jul-ecs-formatter.jar"

With the appropriate logging.properties configuration the Tomcat logs are produced in JSON format.

However, due to various reasons with the way we deploy Tomcat applications, I would like to move away from referencing these jars in the CLASSPATH environment variable.

I have tried various alternate configurations, putting the jars in lib/, adding them to common.loader in conf/catalina.properties, and so on. But nothing else seems to work, i.e. the logs are no longer produced in JSON format.

My question - Is adding these two jars to the Java CLASSPATH environment variable the only way to get these to be recognized by Tomcat?

Thanks.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.