# How to use custom log4j2.properties

**URL:** <https://discuss.elastic.co/t/how-to-use-custom-log4j2-properties/70518>\
**Category:** Logstash\
**Created:** [January 4, 2017, 7:16am UTC](https://discuss.elastic.co/t/how-to-use-custom-log4j2-properties/70518 "2017-01-04T07:16:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wenyao](https://avatars.discourse-cdn.com/v4/letter/w/34f0e0/32.png) [@wenyao](https://discuss.elastic.co/u/wenyao)\
**Post date:** [January 4, 2017, 7:16am UTC](https://discuss.elastic.co/t/how-to-use-custom-log4j2-properties/70518/1 "2017-01-04T07:16:16Z")

</div>

Hi, i need to run two separate instances of logstash with different configurations of log4j2.properties. Is it possible to specify a custom file on execution? If so, please share some examples. Thank you.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 8, 2017, 4:25pm UTC](https://discuss.elastic.co/t/how-to-use-custom-log4j2-properties/70518/2 "2017-01-08T16:25:37Z")

</div>

Logstash has several command-line options for choosing which directories to use and I'm sure one of them can be used to (perhaps indirectly) select which log4j2.properties file to use.

---

<div class="post-metadata">

**Author:** ![wenyao](https://avatars.discourse-cdn.com/v4/letter/w/34f0e0/32.png) [@wenyao](https://discuss.elastic.co/u/wenyao)\
**Post date:** [January 11, 2017, 7:59am UTC](https://discuss.elastic.co/t/how-to-use-custom-log4j2-properties/70518/3 "2017-01-11T07:59:02Z")

</div>

May i know which is the option to do that? I cant seem to find such an option.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 11, 2017, 9:34am UTC](https://discuss.elastic.co/t/how-to-use-custom-log4j2-properties/70518/4 "2017-01-11T09:34:24Z")

</div>

Search for log4j in [https://www.elastic.co/guide/en/logstash/current/command-line-flags.html](https://www.elastic.co/guide/en/logstash/current/command-line-flags.html).

---

<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:** [February 8, 2017, 9:34am UTC](https://discuss.elastic.co/t/how-to-use-custom-log4j2-properties/70518/5 "2017-02-08T09:34:58Z")

</div>

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