I have put log4j to my buildpath, but I get the following message when I run my application:
log4j:WARN No appenders could be found for logger (dao.hsqlmanag
If log4j.properties
is indeed on the classpath, you are using Spring Boot to make a WAR file for deployment to an app server, you are omitting a web.xml
file in favour of Spring Boot's autoconfigure, and you are not getting any log messages whatsoever, you need to explicitly configure Log4j. Assuming you are using Log4j 1.2.x:
public class AppConfig extends SpringBootServletInitializer {
public static void main( String[] args ) {
// Launch the application
ConfigurableApplicationContext context = SpringApplication.run( AppConfig.class, args );
}
@Override
protected SpringApplicationBuilder configure( SpringApplicationBuilder application ) {
InputStream log4j = this.getClass().getClassLoader().getResourceAsStream("log4j.properties");
PropertyConfigurator.configure(log4j);
return application;
}
// Other beans as required...
}