我现在用的室Tomact5.0 有个web程序已经运行,没有出现问题, 但是在Tomact5.0 关闭时候 打印了一下一段话
不知道是什么意思, Tomact5.0在关闭时候肯定无法复制,我是从日志里复制的2009-05-23 19:17:37 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@1d56bbe')
2009-05-23 19:17:37 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@94a28e')
2009-05-23 19:17:37 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@3c40f0')
2009-05-23 19:17:37 StandardContext[/servlets-examples]SessionListener: contextDestroyed()
2009-05-23 19:17:37 StandardContext[/servlets-examples]ContextListener: contextDestroyed()
2009-05-23 19:17:37 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@b98a06')
2009-05-23 19:17:37 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@114a3c6')
2009-05-23 19:17:37 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@c4cee')
2009-05-23 19:17:37 StandardContext[/jsp-examples]SessionListener: contextDestroyed()
2009-05-23 19:17:37 StandardContext[/jsp-examples]ContextListener: contextDestroyed()
2009-05-23 19:17:53 StandardContext[/balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2009-05-23 19:17:53 StandardContext[/jsp-examples]ContextListener: contextInitialized()
2009-05-23 19:17:53 StandardContext[/jsp-examples]SessionListener: contextInitialized()
2009-05-23 19:17:54 StandardContext[/servlets-examples]ContextListener: contextInitialized()
2009-05-23 19:17:54 StandardContext[/servlets-examples]SessionListener: contextInitialized()
2009-05-23 19:24:07 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@a0187c')
2009-05-23 19:24:07 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@a79c31')
2009-05-23 19:24:07 StandardContext[/servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@1ff66bd')
2009-05-23 19:24:07 StandardContext[/servlets-examples]SessionListener: contextDestroyed()
2009-05-23 19:24:07 StandardContext[/servlets-examples]ContextListener: contextDestroyed()
2009-05-23 19:24:07 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@3ac11b')
2009-05-23 19:24:07 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@15be31e')
2009-05-23 19:24:07 StandardContext[/jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@19bd8b4')
2009-05-23 19:24:07 StandardContext[/jsp-examples]SessionListener: contextDestroyed()
2009-05-23 19:24:07 StandardContext[/jsp-examples]ContextListener: contextDestroyed()

解决方案 »

  1.   

    contextDestroyed()销毁上下文对象
      

  2.   

    Tomact5.0 下面的日志包含其下左右项目的日志信息请问怎么在工程下设置一下,把工程日志单独存放到一个文件是不是涉及到log4j什么的?  
      

  3.   

    打印日志用这个
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
      

  4.   

    工程日志的话,你可以在你的启动类, 或者第一个会进入的类中加上 log4j 的配置
      

  5.   

    ### global config ###
    # log level: DEBUG<INFO<WARN<ERROR<FATAL
    log4j.rootLogger=INFO, console, file### appender of console ###
    log4j.appender.console=org.apache.log4j.ConsoleAppender
    log4j.appender.console.layout=org.apache.log4j.PatternLayout
    log4j.appender.console.layout.ConversionPattern=[%-5p  %5r %c] -> %m%n### appender of file ###
    log4j.appender.file=org.apache.log4j.RollingFileAppender
    log4j.appender.file.File=example.log
    log4j.appender.file.MaxFileSize=5KB
    log4j.appender.file.MaxBackupIndex=1
    log4j.appender.file.layout=org.apache.log4j.PatternLayout
    log4j.appender.file.layout.ConversionPattern=[%-5p  %5r  %d{MM-dd HH\:mm\:ss}  %c{5}] -> %m%nlog4j配置