Question

I'm using Embedded Glassfish to do some In-Container-Tests with Arquillian. Now, when my test fails, i always get stacktraces from the tests that are cluttered with Arquillian-specific stuff. But there are few informations about what the real reason for failing tests is. With regular Glassfish, i could check the server.log for more informations. Unfortunately, Embedded Glassfish seems not to provide a Server.log. I also looked into the temporary directory that is created by Arquillian/Embedded Glassfish, but it doesn't contain any logfiles.

How can i activate logging in Embedded Glassfish?

By the way, i have the following dependencies in my pom:

<dependencies>
    <dependency>
        <groupId>org.jboss.arquillian.container</groupId>
        <artifactId>arquillian-glassfish-embedded-3</artifactId>
        <version>1.0.0.Alpha4</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.extras</groupId>
        <artifactId>glassfish-embedded-all</artifactId>
        <version>3.1-b06</version>
    </dependency>

    <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-testng</artifactId>
        <version>1.0.0.Alpha4</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.testng</groupId> 
        <artifactId>testng</artifactId> 
        <version>5.13.1</version> 
        <scope>test</scope> 
    </dependency> 
</dependencies>
Was it helpful?

Solution

I had a lot of difficulty with exactly the same problem using arquillian , testng and embedded glassfish. After a few hours I managed to get it working

What I found was that arquillian has a dependency on version 1.5.9.RC1 of slf4j-simple which uses the slf4j-api.

To get it working I added the property

<properties>
   <version.slf4j>1.5.9.RC1</version.slf4j>
</properties>

and the dependencies

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>${version.slf4j}</version>
</dependency> 

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.16</version>
</dependency>

and then under dependency management

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${version.slf4j}</version>
        </dependency> 
    </dependencies>
</dependencyManagement>  

once I had this I added my usual log4j.properties file to src/test/resources and everything worked fine.

Cheers

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top