GitHub user merrimanr opened a pull request:
https://github.com/apache/incubator-metron/pull/347
METRON-541: Set log levels for Metron components
This PR accomplishes primarily 2 things: sets the log level for all
components (and their dependencies) to ERROR and suppresses ERROR log
statements in tests for cases where an exception is expected. Ideally a
combination of this PR and #344 will make the output logs in Travis much
cleaner.
The approach for setting the log level is to exclude all transitive SJF4J
bindings and instead declare the log4j binding in the metron-platform and
metron-analytics poms (would top level be better?). There is some code that
uses log4j instead SLF4J so this binding seemed appropriate. Now there are no
more SLF4J warnings and the log level for every component can be configured in
test/resources/log4j.properties. It is currently set to ERROR by default but
do we want to add different log files for different profiles (dev, travis,
prod, etc)?
The approach for suppressing expected ERROR log messages is to temporarily
change the log level to SEVERE/FATAL during a test that generates an ERROR
message and change it back right after the test (or line within the test) has
executed. A couple of methods to programmatically change the log level at
runtime was added to the UnitTestHelper class.
There were a few test cases where an exception was incorrectly thrown so I
fixed those (BulkMessageWriterBoltTest.java and ParserBoltTest.java).
There are a lot of different ways to do logging so I'm expecting the
community will have opinions on what the right approach is for us. I have
tested this with unit/integration tests and will test with vagrant once we get
closer to a consensus.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/merrimanr/incubator-metron METRON-541
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-metron/pull/347.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #347
----
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---