2010-11-23 69 views
4

我正在使用嵌入式Glassfish與Arquillian一起執行一些容器內測試。現在,當我的測試失敗時,我總是從測試中得到與Arquillian特定的東西混雜的堆棧跟蹤。但是很少有關於失敗測試的真正原因的信息。 對於普通的Glassfish,我可以查看server.log以獲取更多信息。不幸的是,Embedded Glassfish似乎不提供Server.log。 我也查看了由Arquillian/Embedded Glassfish創建的臨時目錄,但它不包含任何日誌文件。如何在嵌入式Glassfish中獲取Server.log

如何激活嵌入式Glassfish中的日誌記錄?

順便說一句,我在我的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> 

回答

5

我使用的Arquillian,TestNG的嵌入式GlassFish中有很多困難的一模一樣的問題。幾個小時後,我設法得到它的工作

我發現的是,arquillian有依賴於版本1.5.9.RC1的slf4j-simple使用slf4j-api。

得到它的工作我添加屬性

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

<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> 

然後在依賴管理

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

一旦我有這個我加我平時的log4j的依賴.properties文件到src/test/resources,一切正常。

乾杯

相關問題