No appenders could be found for logger(log4j)?

前端 未结 30 2701
[愿得一人]
[愿得一人] 2020-11-22 08:16

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         


        
30条回答
  •  一个人的身影
    2020-11-22 09:04

    I ran into this issue when trying to build an executable jar with maven in intellij 12. It turned out that because the java manifest file didn't include a class path the log4j properties file couldn't be found at the root level (where the jar file was executed from.)

    FYI I was getting the logger like this:

    Logger log = LogManager.getLogger(MyClassIWantedToLogFrom.class);
    

    And I was able to get it to work with a pom file that included this:

             
                maven-assembly-plugin
                2.2-beta-5
                
                    
                        
                            true 
                            com.mycompany.mainPackage.mainClass
                        
                        
                            . 
                        
                    
                    
                        jar-with-dependencies
                    
                
                
                    
                        make-assembly
                        package
                        
                            single
                        
                    
                
            
    

提交回复
热议问题