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

Hi,

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

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-surefire-plugin</artifactId>
                <version>${tycho-version}</version>
                <configuration>
                        <dependency>
                            <groupId>com.example</groupId>
                            <artifactId>com.example.logging.development</artifactId>
                            <version>1.0.0</version>
                            <type>eclipse-plugin</type>
                        </dependency>
                    </dependencies>
                </configuration>
            </plugin>

Kind regards, Jeroen

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

Hello,

 

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 log4j.properties.

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 http://www.slf4j.org/codes.html#StaticLoggerBinder 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 http://logging.apache.org/log4j/1.2/faq.html#noconfig 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: www.fugro.be
Address: Av. de Broqueville 12, 1150 Brussels, Belgium
VAT Nr: BE0418609636



_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user


Back to the top