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:
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:
LogConfigurator.configureWithoutConfig(logSettings());
However, I get this:
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.