Hi,
This is far more complicated than it needs to be.
1. Lose the static block below altogether and initialise the logger
at it's declaration:
static final Logger logger = Logger.getLogger(AppTest.class);
2. Lose the <tesResources> block altogether from your pom and put
your log4j.xml file in src/test/resources.
Then it will "just work".
This is because log4j automatically looks in the classpath for it's
configuration file, and putting it in src/test/resources does this
for you at test runtime.
Steve C.
On 25/02/2007, at 12:56 AM, gerold kathan wrote:
hi, i have the following "issue":
* within my code i am referring to log4j configuration sitting at
static
{
DOMConfigurator.configure("log4j.xml");
logger = Logger.getLogger(AppTest.class);
}
* so it should find the config under the root of project
* OK - i learned to put the stuff under src/main/config/ and tell
pom.xml
via <testResources> entry that he has to include the log4j.xml
<testResources>
<testResource>
<directory>src/test/config</directory>
<includes>
<include>log4j.xml</include>
</includes>
</testResource>
</testResources>
* OK - when i run "mvn test" everything works as expected => the
log4j.xml
is copied under target/test-classes/ (which in fact i assume as
being the
root in context of the test runner
* BUT - log4j complains that it cannot find the config file because
he is
looking under the "general root" of the project (= the directory
where the
pom.xml sits) and NOT within the target/test-classes/ context
any hints on that ?
greetz from vienna,
gerold.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]