Open raminqaf opened 9 months ago
The Environment Lookup in Log4j2 cannot be processed correctly by KPOps. If we define the log4jConfig in the kafka-app like that:
kafka-app: app: streams: brokers: "${brokers}" schemaRegistryUrl: http://schema-registry:8081 log4jConfig: | <?xml version="1.0" encoding="UTF-8"?> <Configuration> <Appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n"/> </Console> </Appenders> <Loggers> <Logger additivity="false" level="$${env:STREAMS_LOG_LEVEL:-info}" name="com.bakdata"> <AppenderRef ref="Console"/> </Logger> <Root level="info"> <AppenderRef ref="Console"/> </Root> </Loggers> </Configuration> labels: pipeline: ${pipeline_name_0}
And then use the KPOps generate ... --template the output of the ConfigMap (where the log config lives) looks like this:
KPOps generate ... --template
# Source: streams-app/templates/log4j-configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: my-streams-app-log4j-configmap data: log4j2.xml: | <?xml version="1.0" encoding="UTF-8"?> <Configuration> <Appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n"/> </Console> </Appenders> <Loggers> <Logger additivity="false" level="${env:STREAMS_LOG_LEVEL:-info}" name="com.bakdata"> <AppenderRef ref="Console"/> </Logger> <Root level="info"> <AppenderRef ref="Console"/> </Root> </Loggers> </Configuration>
That is because string.Template.substitute sees $$ as an escaped $, hence it removes 1 of the dollar signs.
string.Template.substitute
$$
$
The Environment Lookup in Log4j2 cannot be processed correctly by KPOps. If we define the log4jConfig in the kafka-app like that:
And then use the
KPOps generate ... --template
the output of the ConfigMap (where the log config lives) looks like this: