logback在linux上没效果

当保安的程序员 2016-11-27 01:53:49
我们项目日志用的logback,网上的兄弟们都说这东西比Log4j强大不少,于是还得得瑟瑟地觉得高大了一把。可是,项目部署到服务器上以后,发现一个很严重的问题,配置好的Logback居然不起作用啊 我写的绝对路径,压根就不生成日志,日志级别调到了debug都没有,debug和error两个日志都 没有出来,而且我都是root用户启动和部署的tomcat项目。各种抓狂啊,想看日志定位问题都搞不到了,求大神帮帮忙。配置和权限截图如下:


...全文
1500 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
好吧 困扰了自己好多天(后来有其他bug又忙别的去了)的问题,刚刚在一个QQ群里问了别人,人家问我启动日志有没有成功。我说没有错,人家说不是错误,是WARN。然后我再用logback关键字查找,没有发现WARN日志,却发现如下:
27-Nov-2016 15:47:52.830 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/apache-tomcat-8.0.33/webapps/ROOT/WEB-INFb/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/apache-tomcat-8.0.33/webapps/ROOT/WEB-INFb/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
--------server is start
[15:47:53|INFO |(org.springframework.web.context.ContextLoader)]=[Root WebApplicationContext: initialization started]
意思是版本冲突了?然后根据这个上面的提示线索进入http://www.slf4j.org/codes.html#multiple_bindings看到这上面说
SLF4J API is designed to bind with one and only one underlying logging framework at a time. If more than one binding is present on the class path, SLF4J will emit a warning, listing the location of those bindings.

When multiple bindings are available on the class path, select one and only one binding you wish to use, and remove the other bindings
好吧,感觉找到地方了。然后我删掉了其中一个带有log4j的jar包
rm slf4j-log4j12-1.7.5.jar
再启动。没报错。 再到配置的文件夹下面看,果然想要的日志都出来了~~~ 特此回帖记录,给自己也给后面的人警醒,哪怕一个warn一个不是错误的日志都不要放过

5,655

社区成员

发帖
与我相关
我的任务
社区描述
Web开发应用服务器相关讨论专区
社区管理员
  • 应用服务器社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧