mavenlog4jtravis-cilogbackapache-metamodel

Travis max log size & omitting library generated log


I'm using Github (https://github.com/connecta-solutions/connecta-framework) and Travis (https://travis-ci.org/connecta-solutions/connecta-framework) to host and build an open-source project of mine, that uses Apache Metamodel as one of its dependencies.

I'm not making many unit tests, but the log generated by a specific test that uses a feature from Metamodel is gigantic, and passes the 4MB log size determined by Travis, so it quits the build with the following message:

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

Most of the log I get are unimportant debug messages from a Comparator inside Metamodel, which usually gives the following output:

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)

The ideal situation was that Travis somehow accepted this, as unimportant log can quickly become important when you face a problem. Anyway, I tried to reduce the log level to get only warning and errors, passing the argument for log4j to do so, like this:

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

What I later realized was that Logback was the log engine for this Metamodel feature, and I discovered that it's not possible to reduce the loglevel of Logback with a parameter like you can in Log4j. Yet I didn't find a way to remove logback and use the standard logger I'm using for the whole application, then I could control what level it tries to output a message.

Is this the last word of Travis CI? Isn't there a way to keep all the log, even if does pass the 4MB log size?

If it doesn't, how can I remove only this unimportant part of the log inside Metamodel?

Keeping the whole log in dev mode, and just omitting it on a Travis build would be perfect, but if I can't, I can omit this part of the log forever, if there's no choice.


Solution

  • Try to adjust the logging of specific namespace (e.g. whole org.apache.metamodel) via log4j.xml configuration file placed in src/test/resources of your project.

    An example can be found in the metamodel codebase: https://github.com/apache/metamodel/blob/060884c17d1c5c35348d2cb675bed1c404013579/jdbc/src/test/resources/log4j.xml#L12