[MAGNOLIA-6222] Ability to shunt irrelevant and verbose logs in tests Created: 26/May/15 Updated: 05/Jun/15 Resolved: 26/May/15 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | testing |
| Affects Version/s: | None |
| Fix Version/s: | 5.4 |
| Type: | Improvement | Priority: | Trivial |
| Reporter: | Magnolia International | Assignee: | Magnolia International |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Date of First Response: |
| Description |
|
In some tests, irrelevant loggers are pretty verbose. eg when using slf4j-simple and extending RepositoryTestCase, we get a ton of Jackrabbit logging that isn't necessarily helpful.
// Silence log4j completely
org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
or this
// Silence log4j for a specific category
org.apache.log4j.Logger.getLogger(org.apache.commons.digester.Digester.class).setLevel(org.apache.log4j.Level.OFF);
This adds a simple method in TestUtil which does this for both log4j and slf4j-simple. |
| Comments |
| Comment by Mikaël Geljić [ 29/May/15 ] |
|
Tests seemingly shunt loggers but never restore them post-execution; wasn't done before either, but will be worth an improvement. :] |