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

**URL:** <https://discuss.elastic.co/t/alternative-to-classpath-for-ecs-logging-core-jar-and-jul-ecs-formatter-jar-with-tomcat/345785>\
**Category:** Logs\
**Created:** [October 26, 2023, 9:00am UTC](https://discuss.elastic.co/t/alternative-to-classpath-for-ecs-logging-core-jar-and-jul-ecs-formatter-jar-with-tomcat/345785 "2023-10-26T09:00:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexanderDyas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexanderdyas/32/126542_2.png) [@AlexanderDyas](https://discuss.elastic.co/u/AlexanderDyas)\
**Post date:** [October 26, 2023, 9:00am UTC](https://discuss.elastic.co/t/alternative-to-classpath-for-ecs-logging-core-jar-and-jul-ecs-formatter-jar-with-tomcat/345785/1 "2023-10-26T09:00:17Z")

</div>

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](https://www.elastic.co/guide/en/ecs-logging/java/current/setup.html)) 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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 23, 2023, 9:00am UTC](https://discuss.elastic.co/t/alternative-to-classpath-for-ecs-logging-core-jar-and-jul-ecs-formatter-jar-with-tomcat/345785/2 "2023-11-23T09:00:56Z")

</div>

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