din*_*707 7 java log4j maven log4j2
我有一个简单的java项目(maven).这构建了一个jar,我们在其上执行main方法.但是当我mvn clean test在项目上运行时,我从log4j得到了一个日志行
INFO Log4j appears to be running in a Servlet environment, but there's no log4j-web module available. If you want better web container support, please add the log4j-web JAR to your web archive or server lib directory.
Run Code Online (Sandbox Code Playgroud)
该log4j2.xml文件在src/main/resources/log4j2.xml.
有什么想法吗?
如果你servlet-api的类路径中有Jar,Log4j会认为你在Servlet容器中运行.具体来说,它寻找存在javax.servlet.ServletContext.如果你的应用程序没有在Servlet容器中运行,那么你真的不需要那个Jar.
|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           5953 次  |  
        
|   最近记录:  |