# Problem with configuring loggers via LogConfigurator

**URL:** <https://discuss.elastic.co/t/problem-with-configuring-loggers-via-logconfigurator/86318>\
**Category:** Elasticsearch\
**Created:** [May 18, 2017, 6:30pm UTC](https://discuss.elastic.co/t/problem-with-configuring-loggers-via-logconfigurator/86318 "2017-05-18T18:30:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aveyn](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@Aveyn](https://discuss.elastic.co/u/Aveyn)\
**Post date:** [May 18, 2017, 6:30pm UTC](https://discuss.elastic.co/t/problem-with-configuring-loggers-via-logconfigurator/86318/1 "2017-05-18T18:30:13Z")

</div>

Hi,

I am trying to add rolling file appender to logger using LogConfigurator. Right now I have some code prototype and part of basic log4j2 settings:

```auto
private static Settings logSettings() {
        final Settings settings = Settings.builder()
                                          .put("appender.rolling.type", "RollingFile")
                                          .put("appender.rolling.name", "rolling")
                                          .put("appender.rolling.fileName", "D:\\eslog.log")
                                          .put("appender.rolling.layout.type", "PatternLayout")
                                          .put("logger.level", "INFO")
                                          .put("logger.appenderRefs", "rolling")
                                          .build();

        return InternalSettingsPreparer.prepareSettings(settings);
    }

```

and I pass this to LogConfigurator:

```auto
        LogConfigurator.configureWithoutConfig(logSettings());

```

However, I get this:

```auto
Exception in thread "main" java.lang.IllegalArgumentException: Unknown level constant [ROLLING].
	at org.apache.logging.log4j.Level.valueOf(Level.java:314)
	at org.elasticsearch.common.settings.Setting.get(Setting.java:323)
	at org.elasticsearch.common.logging.LogConfigurator.configureLoggerLevels(LogConfigurator.java:144)
	at org.elasticsearch.common.logging.LogConfigurator.configureWithoutConfig(LogConfigurator.java:69)
	at es5test.es5.App.main(App.java:38)

```

After doing some debugging it looks for me like a problem with ESLoggerFactory.LOG\_LEVEL\_SETTING which seems to match every key starting with "logger". I am new to ElasticSearch and configuring log4j2, so I wanted to ask if I am doing something some mistake or if it's really a bug?

I will appreciate any help.

---

<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:** [May 19, 2017, 2:39am UTC](https://discuss.elastic.co/t/problem-with-configuring-loggers-via-logconfigurator/86318/2 "2017-05-19T02:39:03Z")

</div>

You can not configure logging programmatically through `LogConfigurator` like this, only logging levels. If you want to configure logging through `LogConfigurator`, you have to use `log4j2.properties` (and use `LogConfigurator#configure`).

---

<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:** [June 16, 2017, 2:39am UTC](https://discuss.elastic.co/t/problem-with-configuring-loggers-via-logconfigurator/86318/3 "2017-06-16T02:39:07Z")

</div>

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