Hi,
I’m trying to configure logging for the scala stream collector docker image with log4j.
Here’s my log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn">
<Properties>
<Property name="basePath">/snowplow/logs</Property>
</Properties>
<Appenders>
<RollingFile name="fileLogger" fileName="${basePath}/collector-info.log" filePattern="${basePath}/collector-info-%d{yyyy-MM-dd}.log">
<PatternLayout>
<pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
</Policies>
</RollingFile>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n" />
</Console>
<File name="LOGFILE" fileName="${basePath}/Collector.log">
<PatternLayout
pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n" />
</File>
</Appenders>
<Loggers>
<Root level="debug" additivity="false">
<AppenderRef ref="fileLogger" />
<AppenderRef ref="LOGFILE" />
<AppenderRef ref="console" />
</Root>
</Loggers>
</Configuration>
And I launch the container with the command
docker run --name stream-collector ...
snowplow/scala-stream-collector-kinesis:2.1.3 \
-Dlog4j.configurationFile=/snowplow/config//log4j2.xml \
-Dorg.slf4j.simpleLogger.dateTimeFormat=“dd/MM/yyyy” \
-Dorg.slf4j.simpleLogger.showDateTime=true \
-Dorg.slf4j.simpleLogger.defaultLogLevel=debug \
-Dorg.slf4j.simpleLogger.levelInBrackets=true \
--config /snowplow/config/config.hocon`
I get log messages in the console, but those are coming from the slf4j.simpleLogger instead of log4j.
Has anyone configured log4j?