Following a recent article on how to Test System.out with JUnit, here’s a follow up on how to test log4J with JUnit. This article describes a technique to test log4J output in a JUnit test by adding a custom appender. This allows us to verify that log4j output contains expected Strings.
Don’t Panic!
Stuart 'Stevie' Leitch's blog on Software Development, Java Technologies, Security and TestingArchives
Tags
apm appdynamics archetype blame bug ci container DBUnit deploy docker Dockerfile Docker Hub eclipse github hibernate image integration test jetty jsp junit maven microservice mistake MockMVC MySQL netbeans PreAuthorize repository Rule Security SOAP spanners spring Spring-WS spring boot spring mvc spring security tapestry test testing tomcat unit test VM windows WithMockUserLicence
Don't Panic! blog and example code by Stuart 'Stevie' Leitch is licensed under a Creative Commons Attribution 3.0 Unported License.