Skip to content

Make junit tests quiet in normal build targets in log4j 1.2 #11

@apjanke

Description

@apjanke

The site and assembly targets in log4j output hundreds of lines of detailed JUnit test progress and results.

    [...]
    [junit] Testcase: testBadTabbing took 0 sec
    [junit] Testcase: testHeaderLogging took 0.003 sec
    [junit] Testcase: testLayoutHeader took 0.003 sec
    [junit] Testcase: testBigPackets took 0 sec
    [junit] Testcase: testTwoParamConstructor took 0 sec
    [junit] Testcase: testTwoParamConstructorBadFacility took 0 sec
    [junit] Testcase: testThreeParamConstructor took 0.002 sec
    [junit] Testcase: testGetFacilityString took 0 sec
    [junit] Testcase: testGetFacilityStringUnexpected took 0 sec
    [junit] Testcase: testGetFacilityBogus took 0 sec
    [...]

Seems especially gross that, it looks like, unit tests that check that log4j throws exceptions in certain cases output those expected-exception stack traces.

    [...]
    [junit] log4j: Setting property [reconnectionDelay] to [0].
    [junit] log4j: FB: The following error reported: Could not connect to remote log4j server at [localhost]. We are not retrying.
    [junit] java.net.ConnectException: Connection refused (Connection refused)
    [junit] 	at java.net.PlainSocketImpl.socketConnect(Native Method)
    [junit] 	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    [junit] 	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    [junit] 	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    [junit] 	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    [junit] 	at java.net.Socket.connect(Socket.java:607)
    [junit] 	at java.net.Socket.connect(Socket.java:556)
    [junit] 	at java.net.Socket.<init>(Socket.java:452)
    [junit] 	at java.net.Socket.<init>(Socket.java:262)
    [junit] 	at org.apache.log4j.net.SocketAppender.connect(SocketAppender.java:204)
    [junit] 	at org.apache.log4j.net.SocketAppender.activateOptions(SocketAppender.java:161)
    [junit] 	at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:257)
    [junit] 	at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:285)
    [...]

I'd rather not see that unless I explicitly ask for it. See if there's a way to turn all that off. Only output failures and errors by default.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions