# Replacing Log4J2 with Logback

**URL:** <https://discuss.elastic.co/t/replacing-log4j2-with-logback/68949>\
**Category:** Elasticsearch\
**Created:** [December 13, 2016, 11:39pm UTC](https://discuss.elastic.co/t/replacing-log4j2-with-logback/68949 "2016-12-13T23:39:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [December 13, 2016, 11:39pm UTC](https://discuss.elastic.co/t/replacing-log4j2-with-logback/68949/1 "2016-12-13T23:39:38Z")

</div>

With elasticsearch 1.x, you could simply remove the log4j jars from the lib dir, and drop in the slf4j and logback jars.

The same approach doesn't seem to work with elasticsearch 5.x: Removing the log4j2-core jar results in `NoClassDefFoundError: org/apache/logging/log4j/core/config/Configuration`.

Is there still a way to use a different logging framework, or is log4j2 the only option now?

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [December 14, 2016, 4:08am UTC](https://discuss.elastic.co/t/replacing-log4j2-with-logback/68949/2 "2016-12-14T04:08:13Z")

</div>

You want to replace it for the server (not the transport client)? Sorry, that's not going to work without some magic, and we will definitely not support it.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 14, 2016, 7:59am UTC](https://discuss.elastic.co/t/replacing-log4j2-with-logback/68949/3 "2016-12-14T07:59:04Z")

</div>

Adding to this that if you are using the TransportClient you can follow this guide:

[https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/\_using\_another\_logger.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/_using_another_logger.html)

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [December 14, 2016, 7:23pm UTC](https://discuss.elastic.co/t/replacing-log4j2-with-logback/68949/4 "2016-12-14T19:23:09Z")

</div>

Thanks; I was hoping to replace the logger for the standalone server, embedded server, and the transport client. Looks like only latter is still possible, so I'll have to rethink my logging infrastructure as part of the migration ☹

(Have been using Loggly with [this library](https://www.loggly.com/docs/java-logback/), which doesn't have a log4j2 equivalent; even Logstash doesn't seem to have an appender for log4j2?)

---

<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:** [January 11, 2017, 7:23pm UTC](https://discuss.elastic.co/t/replacing-log4j2-with-logback/68949/5 "2017-01-11T19:23:32Z")

</div>

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