Skip to main content
Quick navigation

Fine-tuning log configuration with configuration file

If you want to further customize your logging at an individual logger-level, you can use a custom log4j configuration file.

You must bind mount your custom log4j configuration file to the /app/resources/log4j2.xml path in the container.

Here is the default configuration file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="warn">

<Properties>
<Property name="LOG4J2_TIME_FORMAT">yyyy-MM-dd'T'HH:mm:ss.SSSZ</Property>
<Property name="LOG4J2_APPENDER_LAYOUT">pattern</Property>
<Property name="LOG4J2_ROOT_LEVEL">info</Property>
<Property name="LOG4J2_ORG_APACHE_KAFKA_LEVEL">warn</Property>
<Property name="LOG4J2_IO_KCACHE_LEVEL">warn</Property>
<Property name="LOG4J2_IO_VERTX_LEVEL">warn</Property>
<Property name="LOG4J2_IO_NETTY_LEVEL">error</Property>
<Property name="LOG4J2_IO_CONDUKTOR_LEVEL">info</Property>
<Property name="LOG4J2_IO_CONDUKTOR_PROXY_AUTHORIZATION_LEVEL">info</Property>
<Property name="LOG4J2_IO_CONDUKTOR_PROXY_REBUILDER_COMPONENTS_LEVEL">info</Property>
<Property name="LOG4J2_IO_CONDUKTOR_PROXY_SERVICE_LEVEL">info</Property>
<Property name="LOG4J2_IO_CONDUKTOR_PROXY_NETWORK_LEVEL">info</Property>
<Property name="LOG4J2_IO_CONDUKTOR_PROXY_THREAD_LEVEL">warn</Property>
<Property name="LOG4J2_IO_MICROMETER_LEVEL">error</Property>
</Properties>

<appenders>
<Console name="json" target="SYSTEM_OUT">
<JsonLayout complete="false" compact="true" eventEol="true" properties="true"
objectMessageAsJsonObject="true">
<KeyValuePair key="timestamp" value="$${date:${env:LOG4J2_TIME_FORMAT}}"/>
</JsonLayout>
</Console>
<Console name="pattern" target="SYSTEM_OUT">
<PatternLayout pattern="%d{${env:LOG4J2_TIME_FORMAT}} [%red{%10.25t}] [%green{%-5p}] [%blue{%c{1}:%L}] - %m%n"/>
</Console>
</appenders>

<loggers>
<logger name="org.apache.kafka" level="${env:LOG4J2_ORG_APACHE_KAFKA_LEVEL}" additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>
<logger name="io.kcache" level="${env:LOG4J2_IO_KCACHE_LEVEL}" additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>
<logger name="io.vertx" level="${env:LOG4J2_IO_VERTX_LEVEL}" additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>
<logger name="io.netty" level="${env:LOG4J2_IO_NETTY_LEVEL}" additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>
<logger name="io.conduktor" level="${env:LOG4J2_IO_CONDUKTOR_LEVEL}" additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>
<logger name="io.conduktor.proxy.authorization" level="${env:LOG4J2_IO_CONDUKTOR_PROXY_AUTHORIZATION_LEVEL}"
additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>
<logger name="io.conduktor.proxy.rebuilder.components"
level="${env:LOG4J2_IO_CONDUKTOR_PROXY_REBUILDER_COMPONENTS_LEVEL}" additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>
<logger name="io.conduktor.proxy.service" level="${env:LOG4J2_IO_CONDUKTOR_PROXY_SERVICE_LEVEL}"
additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>
<logger name="io.conduktor.proxy.thread.ProxyThread" level="${env:LOG4J2_IO_CONDUKTOR_PROXY_THREAD_LEVEL}"
additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>
<logger name="io.conduktor.proxy.network" level="${env:LOG4J2_IO_CONDUKTOR_PROXY_NETWORK_LEVEL}"
additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>
<logger name="io.micrometer" level="${env:LOG4J2_IO_MICROMETER_LEVEL}" additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>
<logger name="org.hibernate.validator.internal.util" level="ERROR" additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>
<logger name="io.conduktor.proxy.network.channel.ProxyChannelHandler" level="DEBUG" additivity="false">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</logger>

<AsyncRoot level="${env:LOG4J2_ROOT_LEVEL}">
<appender-ref ref="${env:LOG4J2_APPENDER_LAYOUT}"/>
</AsyncRoot>
</loggers>
</configuration>