kryptolith
2011-09-26 11:02
浏览 305
已采纳

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

以前的项目用到spring+hibernate,只需要导入几个jar包就可以在后台完全的展示框架加载的详细信息,如:
[code="java"]
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:\Java\jdk\bin;D:\Java\tomcat\apache-tomcat-6.0.32\bin
2011-9-26 10:25:12 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8082
2011-9-26 10:25:12 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 618 ms
2011-9-26 10:25:12 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2011-9-26 10:25:12 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.32
2011-9-26 10:25:12 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor host-manager.xml
2011-9-26 10:25:13 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
2011-9-26 10:25:13 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
2011-9-26 10:25:13 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
2011-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 iDianCai
2011-9-26 10:25:13 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(D:\Java\tomcat\apache-tomcat-6.0.32\webapps\iDianCai\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
2011-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

[/code]

但是最近弄了一个开源的项目,里面用的是springMVC+hibernate3的架构,并且日志是采用slf4j+logback+log4j的组合,这样tomcat加载时,后台只有简单的加载文件提示,根本没有详细的框架加载信息的展示...请问这样的如何才能显示详细的信息呢?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • _1_1_7_ 2011-09-26 11:39
    已采纳

    配置在logback.xml中,参考以下:
    [code="xml"]
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE configuration>

    <!-- 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>
    

    [/code]

    点赞 打赏 评论
  • DreamZhong 2011-09-26 11:36

    修改你的log4j配置文件,根据需要进行配置,可以定位到对于某一个包下的所有类进行信息日志输出



    上述配置将对springframwork中的beans包下的所有类进行信息级别及以上的信息日志输出

    点赞 打赏 评论

相关推荐 更多相似问题