【问题标题】:Where to put log4j.properties in a GWT web app在 GWT Web 应用程序中放置 log4j.properties 的位置
【发布时间】:2012-04-18 06:59:41
【问题描述】:

我在 src 下有 log4j.properties 和另一个 .properties 文件,它在 gwt 开发模式下部署。为了构建向 tomcat 启动的战争,我使用了一个 ant 脚本来编译 .java 类并将它们放入 JAR 文件中。 JAR 文件被复制到 war 文件的 WEB-INF 文件夹中。

当我不使用 log4j 时应用程序运行良好,但当我尝试使用 log4j 时它找不到属性文件。我看到的所有答案都说 WEB-INF/classes,但我的项目没有 WEB-INF/classes 目录,而是复制到 WEB-INF 的 JAR 文件包含我的项目类。

【问题讨论】:

    标签: gwt tomcat ant log4j classpath


    【解决方案1】:

    您必须将 log4j.properties(或 log4j.xml)文件放入您的 servlet-container 将其视为 Classpath 中的资源的目录或 JAR 中。

    因此,只需创建 WEB-INF/classes 目录并将其放在那里,或者将其打包到您的 JAR 中。

    另请参阅Where should I put the log4j.properties file? - 它可能很有用。

    【讨论】:

      猜你喜欢
      • 2015-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-02
      • 1970-01-01
      • 2012-05-19
      • 2014-08-13
      • 1970-01-01
      相关资源
      最近更新 更多