java - How to set log4j config to project's dependencies? -


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:

  1. log4j-api (always)
  2. log4j-core (always)
  3. log4j-1.2-api
  4. log4j-jcl
  5. log4j-slf4j-impl (do not add log4j-to-slf4j)

remove other logging implementations:

  1. log4j-1.2.x
  2. logback-core-*
  3. logback-classic-*

keep facades:

  1. commons-logging-*
  2. slf4j-api-*

Comments