S
S
s2019-08-20 14:54:38
Java
s, 2019-08-20 14:54:38

Why are the messages displayed in a different format when running an application with and without log4j in docker?

When I start the application normally, I get messages with the INFO level in json format, when I run it in a docker container with the same INFO level, I get regular strings. What could be the problem?
Here is the logger config file:

Configuration:
  Appenders:
    Console:
      name: Console
      JsonLayout:
        complete: true
        compact: true
        eventEol: true
      target: SYSTEM_OUT
  Loggers:
    Root:
      AppenderRef:
        - ref: Console
      level: INFO

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
s, 2019-08-20
@solovladys

in general, in Dockerfile added:
COPY src/main/resources/log4j2.yml /opt/log4j2.yml
and in CMD: "-Dlog4j.configurationFile=file:/opt/log4j2.yml"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question