i using log4j2
in project -dlog4j.configurationfile=src/main/resources/log4j2.xml
.
application loggers write logs in format specified configuration file.
i have other dependencies (sparkjava
, hazelcast
, mongodb
, sql2o
etc..) write logs, in different format. loggers use log4j
configuration file.
how can it?
edit:
my log4j2.xml
looks this:
<?xml version="1.0" encoding="utf-8"?> <configuration status="warn"> <appenders> <console name="console" target="system_out"> <patternlayout pattern="%d{hh:mm:ss.sss} [%t] %-5level %logger{36} - %msg%n"/> </console> </appenders> <loggers> <root level="trace"> <appenderref ref="console"/> </root> </loggers> </configuration>
as understand it, every log message should relate root
logger, , formatted according log4j2.xml
configuration file.
add log4j 2 jars , adapters other logging apis:
- log4j-api (always)
- log4j-core (always)
- log4j-1.2-api
- log4j-jcl
- log4j-slf4j-impl (do not add log4j-to-slf4j)
remove other logging implementations:
- log4j-1.2.x
- logback-core-*
- logback-classic-*
keep facades:
- commons-logging-*
- slf4j-api-*
Comments
Post a Comment