2016-12-26 93 views
0

我使用Github(https://github.com/connecta-solutions/connecta-framework)和Travis(https://travis-ci.org/connecta-solutions/connecta-framework)來託管和構建我的開源項目,該項目使用Apache Metamodel作爲其依賴項之一。Travis最大日誌大小和省略庫生成日誌

我沒有進行很多單元測試,但是使用Metamodel中的一個特性生成的日誌是巨大的,並且傳遞了Travis確定的4MB日誌大小,因此它會使用以下消息退出構建:

The log length has exceeded the limit of 4 MB (this usually means that the test suite is raising the same exception over and over). 

The job has been terminated 

大多數日誌,我得到的是來自內部的元模型,通常給出以下輸出的比較不重要的調試消息:

18:18:23.519 [main] DEBUG o.a.metamodel.util.ObjectComparator - compare(Sul,50) 
18:18:23.519 [main] INFO o.a.metamodel.util.ObjectComparator - Using ToStringComparator because no apparent better comparison method could be found 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - SUM(csv_cities.csv.vendas).hashCode() 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is null, returning constant 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is null, returning constant 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is a regular object, returning hashCode 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is a regular object, returning hashCode 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is a regular object, returning hashCode 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is null, returning constant 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is null, returning constant 
18:18:23.519 [main] DEBUG o.a.metamodel.util.EqualsBuilder - append(false) 
18:18:23.519 [main] DEBUG o.a.metamodel.util.EqualsBuilder - append(true) 
18:18:23.519 [main] DEBUG o.a.metamodel.util.ObjectComparator - compare(Sul,50) 
18:18:23.519 [main] INFO o.a.metamodel.util.ObjectComparator - Using ToStringComparator because no apparent better comparison method could be found 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - SUM(csv_cities.csv.vendas).hashCode() 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is null, returning constant 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is null, returning constant 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is a regular object, returning hashCode 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is a regular object, returning hashCode 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is a regular object, returning hashCode 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is null, returning constant 
18:18:23.519 [main] DEBUG org.apache.metamodel.util.BaseObject - obj is null, returning constant 
18:18:23.519 [main] DEBUG o.a.metamodel.util.EqualsBuilder - append(false) 
18:18:23.519 [main] DEBUG o.a.metamodel.util.EqualsBuilder - append(true) 

理想的情況是,特拉維斯莫名其妙地接受了這個,不重要的日誌可以很快成爲當您遇到問題時,您很重要。無論如何,我試圖減少日誌級別來獲得唯一的警告和錯誤,傳遞參數的log4j的這樣做,是這樣的:

mvn test -Dorg.slf4j.simpleLogger.defaultLogLevel=warn 

我後來才意識到是的logback是這個元模型功能日誌引擎,並且我發現用Log4j中的參數來減少Logback的日誌級別是不可能的。然而,我沒有找到一種方法來刪除logback並使用我用於整個應用程序的標準記錄器,然後我可以控制它嘗試輸出消息的級別。

這是Travis CI的最後一個詞嗎?沒有辦法保留所有日誌,即使通過4MB日誌大小?

如果沒有,我該如何刪除Metamodel內部的這個不重要的部分?

保持在開發狀態的總體日誌,只是忽略它在特拉維斯構建將是完美的,但如果我不能,我可以永遠忽略日誌的這部分,如果沒有選擇。

回答

1

嘗試通過log4j.xml配置文件放置在項目的src/test/resources中來調整特定命名空間(例如整個org.apache.metamodel)的日誌記錄。

可以在元模型代碼庫中找到一個示例:https://github.com/apache/metamodel/blob/060884c17d1c5c35348d2cb675bed1c404013579/jdbc/src/test/resources/log4j.xml#L12

+0

好的,Tomas!我現在就試試看:) – ViniciusPires

+0

有趣的是,它不起作用,因爲我的Metamodel仍在使用Logback,但在您的鏈接中,Metamodel的依賴關係僅指向log4j。我將調查哪個模塊引入了這種依賴關係,並嘗試修復它... – ViniciusPires

+0

我排除了可能正在使用的所有記錄器模塊,而不是lo4j,現在它可以工作。非常感謝 :) – ViniciusPires

相關問題