I am trying to add a custom Log4J
configuration to a large software project built using IntelliJ 2016.1
, but the IDE seems to completely ignore the properties file supplied (log4j.properties
in plain text - not XML) in unit tests.
More specifically, running tests written against JUnit
4, IntelliJ
does not show any logging messages without going to the Run | Edit configurations
menu and then supplying the following argument to the VM, via the VM Options
box:
- -Dlog4j.configuration=/absolute/path/to/log4j.properties
The weird thing is that the contents of the file specified are completely ignored.
So, even if the above path is replaced by a path to a file that does not even exist, or if the path is deleted altogether, IntelliJ
continues printing logging messages in the same layout as before, as if it reads the properties from a completely different location. Removing the -Dlog4j.configuration
parameter, stops logging messages entirely. It's as if the IDE understands the -Dlog4j.configuration
as an ON/OFF switch for logging, without caring about any path supplied with it.
There are multiple Log4J
and SLF4J
JARs in the project classpath and numerous log4j.properties
files around, but even deleting all of the latter doesn't change the logging output. Apparently the properties file specified via -Dlog4j.configuration
is ignored by Log4J
all the time.
Any ideas?