I'm using Spring Framework (4.1.0) to build sample application where I can play with Unit Tests.
My test class use @RunWith(SpringJUnit4ClassRunner.class) annotation which logs WARNS
log4j:WARN No appenders could be found for logger (org.springframework.test.context.junit4.SpringJUnit4ClassRunner).
log4j:WARN Please initialize the log4j system properly.
in console because I'm not using log4j2 file based configuration.
My test class also use @ContextConfiguration(classes = { AppConfig.class, ServletConfig.class }) annotation to point to context where I try to initialize log4j2.
Question: How can I properly initialize log4j2 to use it with SpringJUnit4ClassRunner without file based configuration ?
Other Java based config approaches are welcome :)
SpringJUnit4ClassRunnerhas nothing to do with log4j. - HannesSpringJUnit4ClassRunnerat the beginning we haveprivate static final org.apache.commons.logging.Log logger;which means it's related withlog4j2. - xyz