Travis max log size&省略库生成的日志

时间:2016-12-26 20:52:57

标签: maven log4j travis-ci logback apache-metamodel

我使用Github(https://github.com/connecta-solutions/connecta-framework)和Travis(https://travis-ci.org/connecta-solutions/connecta-framework)来托管和构建我的开源项目,该项目使用Apache Metamodel作为其依赖项之一。

我没有进行很多单元测试,但是使用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

我得到的大部分日志都是来自Metamodel内的Comparator的不重要的调试消息,它通常会提供以下输出:

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是这个Metamodel功能的日志引擎,我发现用Log4j中的参数可以减少Logback的loglevel是不可能的。然而,我没有找到一种方法来删除回溯并使用我用于整个应用程序的标准记录器,然后我可以控制它尝试输出消息的级别。

这是Travis CI的最后一句话吗?是不是有办法保留所有日志,即使它通过了4MB的日志大小?

如果没有,我怎样才能删除Metamodel中日志中这个不重要的部分?

保持整个日志处于开发模式,只是在Travis构建中省略它将是完美的,但如果我不能,我可以永远省略这部分日志,如果没有选择

1 个答案:

答案 0 :(得分:1)

尝试通过放置在项目org.apache.metamodel中的log4j.xml配置文件调整特定命名空间的记录(例如整个src/test/resources)。

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