Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] configuring log4j for unit tests


You need to add the fragment to the test-plugin configuration:


Kind regards, Jeroen

On 18/09/2013 12:33, Velde, Erik Vande [FGCB] wrote:



I created a simple unit test that happens to test a class which logs to a slj4j logger. When running the test I want to use the log4j implementation of slf4j, and provide it with the traditional

According to some posts on the internet you should create a fragment for this, only containing the properties file, and deploy that to the OSGI container.

This works when I run the test from eclipse as a plug-in test, there I can specify the log4j-properties-fragment in the list of plugins to deploy to the container

When I do a ‘run as junit test’ I get this error message in my console:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

SLF4J: Defaulting to no-operation (NOP) logger implementation

SLF4J: See for further details.

When I run the test with the tycho surefire plugin 0.18.0 from the command line it says:

log4j:WARN No appenders could be found for logger (com.fugro.gwf.common.domain.rules.aspects.BusinessRuleAspect).

log4j:WARN Please initialize the log4j system properly.

log4j:WARN See for more info.

My question: is there a way to have the log4j logging working in all three scenario’s ?


Kind regards,
Fugro GeoConsulting

Erik Vande Velde
Senior Software Coordinator

Telephone: +32 (0)2 77 60 034 / Fax: +32 (0)2 77 60 319
E-mail: EvandeVelde@xxxxxxxx / Website:
Address: Av. de Broqueville 12, 1150 Brussels, Belgium
VAT Nr: BE0418609636

tycho-user mailing list

Back to the top