我在web.xml设了:
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>abc.root</param-value>
</context-param>
然后在log4j.properties里设了:
log4j.appender.logfile.File=${abc.root}/abc.log我的tomcat是5.0.28,装在D:\最后自动生成的日志为D:\abc.log为什么${abc.root}不起作用呢?应该怎么配呀??????

解决方案 »

  1.   

    log4j.appender.logfile.File=${webAppRootKey}/abc.log
      

  2.   

    发现properties不能调用这个路径,所以要换个角度思考。就是动态配置这个文件。
    在java文件里对这个文件先进行操作,设定文件路径,不过好象比较不合常理
      

  3.   

    找到一个相关的资料。
    http://www.javaresearch.org/article/showarticle.jsp?column=2&thread=12639
      

  4.   

    多谢 mofeir(莫飞) 不过我前面已自己解决了,关键是看这个
    <!--
    - Key of the system property that should specify the root directory of this
    - web app. Applied by WebAppRootListener or Log4jConfigListener.
     -->
    加上WebAppRootListener 或Log4jConfigListener就得了