关于web项目控制台日志展示问题

问题描述

以前的项目用到spring+hibernate,只需要导入几个jar包就可以在后台完全的展示框架加载的详细信息,如:2011-9-26 10:25:12 org.apache.catalina.core.AprLifecycleListener init信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:Javajdkbin;D:Javatomcatapache-tomcat-6.0.32bin2011-9-26 10:25:12 org.apache.coyote.http11.Http11Protocol init信息: Initializing Coyote HTTP/1.1 on http-80822011-9-26 10:25:12 org.apache.catalina.startup.Catalina load信息: Initialization processed in 618 ms2011-9-26 10:25:12 org.apache.catalina.core.StandardService start信息: Starting service Catalina2011-9-26 10:25:12 org.apache.catalina.core.StandardEngine start信息: Starting Servlet Engine: Apache Tomcat/6.0.322011-9-26 10:25:12 org.apache.catalina.startup.HostConfig deployDescriptor信息: Deploying configuration descriptor host-manager.xml2011-9-26 10:25:13 org.apache.catalina.startup.HostConfig deployDescriptor信息: Deploying configuration descriptor manager.xml2011-9-26 10:25:13 org.apache.catalina.startup.HostConfig deployDirectory信息: Deploying web application directory docs2011-9-26 10:25:13 org.apache.catalina.startup.HostConfig deployDirectory信息: Deploying web application directory examples2011-9-26 10:25:13 org.apache.catalina.core.ApplicationContext log信息: ContextListener: contextInitialized()2011-9-26 10:25:13 org.apache.catalina.core.ApplicationContext log信息: SessionListener: contextInitialized()2011-9-26 10:25:13 org.apache.catalina.startup.HostConfig deployDirectory信息: Deploying web application directory iDianCai2011-9-26 10:25:13 org.apache.catalina.loader.WebappClassLoader validateJarFile信息: validateJarFile(D:Javatomcatapache-tomcat-6.0.32webappsiDianCaiWEB-INFlibservlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class2011-9-26 10:25:15 org.apache.catalina.core.ApplicationContext log信息: Initializing Spring root WebApplicationContext- Root WebApplicationContext: initialization started- Refreshing org.springframework.web.context.support.XmlWebApplicationContext@197d20c: display name [Root WebApplicationContext]; startup date [Mon Sep 26 10:25:15 CST 2011]; root of context hierarchy- Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]- Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext-system.xml]- Overriding bean definition for bean 'pictureService': replacing [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext.xml]] with [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-system.xml]]- Overriding bean definition for bean 'versionService': replacing [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext.xml]] with [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-system.xml]]- Overriding bean definition for bean 'pictureDao': replacing [Generic bean: class [com.idiancai.system.dao.impl.PictureDAO]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext.xml]] with [Generic bean: class [com.idiancai.system.dao.impl.PictureDAO]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-system.xml]]- Overriding bean definition for bean 'versionDao': replacing [Generic bean: class [com.idiancai.system.dao.impl.VersionDAO]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext.xml]] with [Generic bean: class [com.idiancai.system.dao.impl.VersionDAO]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-system.xml]]- Overriding bean definition for bean 'unitDao': replacing [Generic bean: class [com.idiancai.system.dao.impl.UnitDAO]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext.xml]] with [Generic bean: class [com.idiancai.system.dao.impl.UnitDAO]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-system.xml]]- Overriding bean definition for bean 'typeDao': replacing [Generic bean: class [com.idiancai.business.dao.impl.TypeDAO]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext.xml]] with [Generic bean: class [com.idiancai.system.dao.impl.TypeDAO]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-system.xml]]- Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext-business.xml]- Overriding bean definition for bean 'discountService': replacing [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext.xml]] with [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-business.xml]]- Overriding bean definition for bean 'orderService': replacing [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext.xml]] with [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-business.xml]]- Overriding bean definition for bean 'orderDishService': replacing [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext.xml]] with [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-business.xml]]- Overriding bean definition for bean 'popularService': replacing [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-system.xml]] with [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-business.xml]]- Overriding bean definition for bean 'purposeService': replacing [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-system.xml]] with [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-business.xml]]- Overriding bean definition for bean 'typeService': replacing [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-system.xml]] with [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-business.xml]]- Overriding bean definition for bean 'unitService': replacing [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-system.xml]] with [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-business.xml]]- Overriding bean definition for bean 'subwayService': replacing [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-system.xml]] with [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-business.xml]]- Overriding bean definition for bean 'areaService': replacing [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-system.xml]] with [Generic bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in ServletContext resource [/WEB-INF/applicationContext-business.xml]]- Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@197d20c]: org.springframework.beans.factory.support.DefaultListableBeanFactory@64a871- Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@64a871: defining beans [dataSource,sessionFactory,transactionManager,baseTransactionProxy,/login,/forward,baseDao,/androir,/order,/getdis,/getpra,/gettas,/upfile,/getweb,androirService,orderService,orderDishService,discountService,getPraService,getTasService,versionService,pictureService,webOrderSummaryService,webOrderDetailService,orderDao,orderDishDao,menuDao,typeDao,dishDao,dishDetailDao,pageDao,pageDishDao,discountDao,versionDao,practiceDao,tasteDao,unitDao,pictureDao,summaryDao,orderDetailDao,/loginSys,/sys/bis,/sys/dish,/sys/groupBuy,/sys/coupon,areaService,dictionaryService,parameterService,subwayService,unitService,popularService,purposeService,typeService,sysUserService,areaDao,dictionaryDao,parameterDao,subwayDao,popularDao,purposeDao,sysUserDao,area,dictionary,parameter,picture,subway,version,recommend,unit,popular,purpose,type,sysUser,/bis/login,/bis/business,/bis/bisImage,/bis/menu,/bis/type,/bis/page,/bis/pageDish,/bis/dishImage,/bis/dish,/bis/taste,/bis/practice,/bis/disTip,/bis/discount,/bis/getorder,/bis/getCascadeInfo,businessService,businessMoreService,dishService,dishDetailService,menuService,pageService,pageDishService,practiceService,reviewService,tasteService,recommendService,directoryService,disTipService,userService,deskService,businessDao,businessMoreDao,reviewDao,recommendDao,directoryDao,disTipDao,webOrderDao,userDao,deskDao,business,businessMore,discount,dish,dishDetail,menu,order,orderDish,page,pageDish,practice,review,taste,disTip,desk,/web/user,/web/webOrder,/web/web,/web/webUser/review,/web/bis,/web/groupBuy,/web/coupon,webOrderService,groupBuyService,webOrderSortService,couponService,webOrderSummaryDao,webOrderDetailDao,groupBuyDao,couponDao,webOrderSortDao,webOrder,user,groupBuy,coupon,/pri/privilege,/pri/role,/pri/userRole,/pri/rolePrivilege,privilegeService,roleService,rolePrivilegeService,userRoleService,privilegeDao,roleDao,rolePrivilegeDao,userRoleDao,privilege,role,roleprivilege,userRole,/dish/sav,saveDishService]; root of factory hierarchy- Hibernate 3.2.6- hibernate.properties not found- Bytecode provider name : cglib- using JDK 1.4 java.sql.Timestamp handling- configuring from url: file:/D:/Java/tomcat/apache-tomcat-6.0.32/webapps/iDianCai/WEB-INF/classes/hibernate.cfg.xml- Reading mappings from resource : com/idiancai/system/domain/Area.hbm.xml- Mapping class: com.idiancai.system.domain.Area -> TB_SYS_AREA- Reading mappings from resource : com/idiancai/system/domain/Dictionary.hbm.xml- Mapping class: com.idiancai.system.domain.Dictionary -> TC_SYS_DICTIONARY- Reading mappings from resource : com/idiancai/system/domain/Parameter.hbm.xml- Mapping class: com.idiancai.system.domain.Parameter -> TC_SYS_PARAMETER- Reading mappings from resource : com/idiancai/system/domain/Picture.hbm.xml- Mapping class: com.idiancai.system.domain.Picture -> TB_SYS_PICTURE - Reading mappings from resource : com/idiancai/system/domain/Subway.hbm.xml- Mapping class: com.idiancai.system.domain.Subway -> TB_SYS_SUBWAY- Reading mappings from resource : com/idiancai/system/domain/Version.hbm.xml- Mapping class: com.idiancai.system.domain.Version -> TB_SYS_VERSION- Reading mappings from resource : com/idiancai/system/domain/Recommend.hbm.xml- Mapping class: com.idiancai.system.domain.Recommend -> TB_SYS_RECOMMEND- Reading mappings from resource : com/idiancai/system/domain/Unit.hbm.xml但是最近弄了一个开源的项目,里面用的是springMVC+hibernate3的架构,并且日志是采用slf4j+logback+log4j的组合,这样tomcat加载时,后台只有简单的加载文件提示,根本没有详细的框架加载信息的展示...请问这样的如何才能显示详细的信息呢?

解决方案

配置在logback.xml中,参考以下:<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE configuration><configuration debug="false"><!-- jmxConfigurator /--><conversionRule conversionWord="short"converterClass="com.csii.pe.common.logging.ShortLoggerConverter" /><conversionRule conversionWord="count"converterClass="com.csii.pe.common.logging.CountingConverter" /><appender name="CONSOLE"class="ch.qos.logback.core.ConsoleAppender"><layout class="ch.qos.logback.classic.PatternLayout"><Pattern>%d{HH:mm:ss.SSS} %logger %m%n</Pattern></layout></appender><appender name="FILE"class="com.csii.pe.common.logging.DynamicRollingFileAppender"><Filter class="com.csii.ibs.custom.fjsnx.action.FilterPassword" /><File>/netbank/logs/eweb/logFile.%d{yyyy-MM-dd}.log</File><layout class="ch.qos.logback.classic.PatternLayout"><Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] %logger %X{sessionId} %X{transId} %X{transName} %X{userId} %m%n</Pattern></layout></appender><logger name="org.springframework" additivity="false"><level value="info" /><appender-ref ref="CONSOLE" /></logger><logger name="java.sql" additivity="false"><level value="debug" /><appender-ref ref="CONSOLE" /></logger><logger name="com"additivity="true"><level value="info" /><appender-ref ref="CONSOLE" /></logger><root><level value="info" /><appender-ref ref="CONSOLE" /></root></configuration>
解决方案二:
修改你的log4j配置文件,根据需要进行配置,可以定位到对于某一个包下的所有类进行信息日志输出<logger name="org.springframework.beans"><level value="info" /></logger>上述配置将对springframwork中的beans包下的所有类进行信息级别及以上的信息日志输出

时间: 2024-10-24 19:17:20

关于web项目控制台日志展示问题的相关文章

web项目中关于修改功能的问题

问题描述 web项目中关于修改功能的问题 在写修改代码的时候,有一些不会变动的字段,如id,创建时间等,对于这些字段的处理方法除了下面几种还有什么方法吗?1.隐藏到页面上2.修改的时候再从数据库查询一次3.保存到服务器上我觉得这三种方法都不太好,想问一下还有没其他更好的方法呀? 解决方案 如果是hibernate,,给不更新的字段设置update为false 解决方案二: session域,request域 解决方案三: 如果是页面效果,你就给它不可编辑的属性. 解决方案四: 不更新不需要修改的

通过tomcat启动后的web项目如何跟另外一个java项目交互

问题描述 通过tomcat启动后的web项目如何跟另外一个java项目交互 项目经理让我完成对一个web项目的日志级别动态修改,要我提供一个接口用于修改日志级别, 我首先想到了使用servlet,通过访问servlet来修改,可项目经理却叫我用Main来实现这一功能,生成一个jar包通过本地的脚本语言调用这个jar包的Main方法来修改日志级别.Socket也不能使用. 两个java程序在以上不能使用的方法外,还能可以使用哪些方法进行交互呢? 解决方案 http://www.iteye.com/

log4j2 0-用了log4j2,web项目中只有控制台输出,没有日志记录。tomcat7.0.59,谁知道什么原因

问题描述 用了log4j2,web项目中只有控制台输出,没有日志记录.tomcat7.0.59,谁知道什么原因 用了log4j2,web项目中只有控制台输出,没有日志记录.tomcat7.0.59,谁知道什么原因

log4j日志问题-在非WEB项目中配置了log4j日志的配置文件,日志应该打在哪个目录下的文件

问题描述 在非WEB项目中配置了log4j日志的配置文件,日志应该打在哪个目录下的文件 我发现只有在控制台可以看到日志,日志不会到印到文件里面,求帮忙解决一下 我以为是打印到log/test.log文件里面的,但是没有,自己创建了文件,也不会写进去 log4j.propertis文件内容如下: log_home=../log log4j.rootLogger=debug,Console log4j.appender.Console=org.apache.log4j.ConsoleAppender

idea+maven导入web项目后,tomcat无报错,无日志输出,启动失败,求大神!

问题描述 idea+maven导入web项目后,tomcat无报错,无日志输出,启动失败,求大神! 模块之间的依赖关系可以从这个pom中看出来 把这三个子模块的编译结果都输出到platform的webappWEB-INFclasses,所依赖的jar包通过Maven也输出到webappWEB-INFlib, 然后tomcate 这样配置的 然后启动tomcate 无报错 无log 直接停止,真的太诡异了! 大神们,帮帮忙!太感谢了!!! 解决方案 用IDEA启动非maven管理的web项目 解决

hierarchy-JAVA web项目放到服务器,tomcat打不开是怎么回事,下面是日志代码

问题描述 JAVA web项目放到服务器,tomcat打不开是怎么回事,下面是日志代码 2015-08-12 15:35:53 Commons Daemon procrun stdout initialized 15:36:02,622 [ localhost-startStop-1 ] [ INFO ]:510 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@6258f2b8: st

绑定日志-maven jetty 环境下的Web项目在使用logback slf4j时,slf4j总是绑定java.util.logging

问题描述 maven jetty 环境下的Web项目在使用logback slf4j时,slf4j总是绑定java.util.logging Logger logger = (Logger) LoggerFactory.getLogger(UserAction.class); logger.info("loginUser:username{},password{}",username,password); java.lang.ClassCastException: org.slf4j.

debug-eclipse用java写web项目,操作页面时怎么证明哪些代码,哪些方法被调用执行了

问题描述 eclipse用java写web项目,操作页面时怎么证明哪些代码,哪些方法被调用执行了 跑web项目,在页面进行操作,怎么查明这个操作调用了哪些类的哪些方法以及执行顺序,本人不怎么会调试,能具体点最好,感激不尽 解决方案 楼主可能没有工作吧,其实这个问题稍微有个人简单一说就会了,从浏览器要学会使用开发者模式,例如firefox的debug模式,这个可以查看页面操作 后发送了哪些请求,然后得到了什么响应,请求就可以知道你调用了哪个Action,从而知道调用后台哪些方法,后台如果用ecli

深入浅析java web log4j 配置及在web项目中配置Log4j的技巧_java

在上篇文章给大家介绍了Java log4j详细教程,本文给大家介绍java web log4j配置及web项目中配置log4j的技巧.具体详情请看下文吧. 首先给大家提供log4j.jar下载:http://logging.apache.org/log4j/1.2/download.html 一.java web项目使用log4j 1.在web.xml文件中添加 <!-- 配置log4j --> <context-param> <param-name>webAppRoo