cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominic Mitchell <>
Subject Re: [2.2] Configure logging for tests
Date Mon, 23 Nov 2009 16:01:05 GMT
On Mon, Nov 23, 2009 at 3:41 PM, Andreas Hartmann <>wrote:

> Hi everyone,
> I'm using Cocoon 2.2.
> How do I configure the logging output for my unit tests?
> This tutorial helped me a lot for the web application, but it doesn't seem
> to work for the tests …
> Thanks a lot for any hints!
That's because the tests aren't run inside a jetty container.  They're just
run inside JUnit.

The easiest way that I've found in the past is to create a file
src/main/resources/ with the desired test logging setup.
 When the tests fire up, log4j auto-detects it because it'll be at the root
of the classpath.

If that fails, there are other options:

   - Set up a base class for all your tests, which has a setUp() which
   invokes PropertyConfigurator.configure(…)<>
   - Set up maven to invoke the tests in a forked JVM, and pass in the
   log4j.configuration system property.  Look at the docs for the surefire


View raw message