The reason for this behaviour is the following:

The log4j-test.properties is not a standard log4j properties file. It is
only used if it is explicitly given to the executing JVM by
-Dlog4j.configuration. The parent pom defines for the surefire plugin a
corresponding argument line with this option. Intellij uses these maven
settings for executing Java JUnit tests. For the scala tests which are
executed with JUnitRunner, these settings are not used. I don't know why
this is the case for the scala tests. But in order to get consistent
behaviour you can turn off the maven settings import by unticking Build,
Execution, Deployment -> Build Tools -> Maven -> Running Tests -> argLine
in the IntelliJ settings.

On Wed, Feb 25, 2015 at 2:02 PM, Ufuk Celebi <u...@apache.org> wrote:

> Hey Flinksters and IntelliJers, ;-)
>
> the tests resources directory of each Maven module contains a
> log4j-test.properties files, which gets picked via the classpath by JUnit
> tests, but not Scalatest. Instead Scalatest picks up log4j.properties, but
> JUnit doesn't.
>
> It works when I specify the file via the log4j.configuration property as a
> VM argument in the default run config for Scalatest.
>
> Is there another solution? And why is it behaving like this?
>
> – Ufuk

Reply via email to