java - How to use multiple configuration files for log4j2 -


i writing java code tests java library. library includes own log4j2 configuration part of distribution.

i use log4j2 in test code without modifying library's configuration.

is there way have separate log4j2 configuration test code?

this running command-line java, no servers or web involvement @ all.

edit try more clear: want able configure loggers, appenders, etc test code use , , at same time have library code use its own separate configuration file logging. idea use log4j2 in test code, without having change library's configuration file. since library configuration file part of library's distribution, don't want change testing.

this may helpful:

  • log4j2 first log4j2-test.xml in classpath
  • if file not found, log4j2.xml in classpath

so 1 option copy library's configuration (log4j2.xml) log4j2-test.xml , add own configuration log4j2-test.xml.

furthermore, log4j2 supports xinclude in xml configuration, use feature avoid duplicating library's configuration in log4j2-test.xml.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -