java - log4j:在 Windows 上的 Websphere 上找不到资源
问题描述
我在C:\log\server-log4j.xml
Windows 操作系统的文件夹中有一个 log4j 的配置文件。
在 Websphere Application Server 中,我尝试了以下 JVM 开关 - 所有这些都会导致log4j: Could not find resource
服务器启动日志:
-Dlog4j.debug -Dlog4j.configuration="file:///log/server-log4j.xml" -Dlogging.config="file:///log/server-log4j.xml"
-Dlog4j.debug -Dlog4j.configuration="file:/C:/log/server-log4j.xml" -Dlogging.config="file:/C:/log/server-log4j.xml"
-Dlog4j.debug -Dlog4j.configuration="C:/log/server-log4j.xml" -Dlogging.config="C:/log/server-log4j.xml"
-Dlog4j.debug -Dlog4j.configuration="file:C:\log\server-log4j.xml" -Dlogging.config="file:C:\log\server-log4j.xml"
应用服务器启动日志的完整跟踪如下:
[16/03/21 09:20:01:784 GMT] 00000045 SystemOut O log4j: Trying to find ["C:/log/server-log4j.xml"] using context classloader
com.ibm.ws.classloader.CompoundClassLoader@e7f8d850[war:app/app-web.war]
Local ClassPath: C:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\ServerNode01Cell\app.ear\app-web.war\WEB-INF\classes;C:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\AppSrv01\installedApps\ServerNode01Cell\app.ear\app-web.war
Parent: com.ibm.ws.classloader.CompoundClassLoader@3ef04a80[PF][app]
Delegation Mode: PARENT_LAST.
[16/03/21 09:20:01:846 GMT] 00000045 SystemOut O log4j: Trying to find ["C:/log/server-log4j.xml"] using com.ibm.ws.bootstrap.ExtClassLoader@7548c7a5 class loader.
[16/03/21 09:20:01:846 GMT] 00000045 SystemOut O log4j: Trying to find ["C:/log/server-log4j.xml"] using ClassLoader.getSystemResource().
[16/03/21 09:20:01:862 GMT] 00000045 SystemOut O log4j: Could not find resource: ["C:/log/server-log4j.xml"].
什么是正确的语法?
解决方案
推荐阅读
- customization - 用于生成 XSL-FO 的 xalan 文档样式表:XSLT 错误 (java.lang.NoClassDefFoundError): org/apache/xml/serializer/SerializerTrace
- excel - Excel 向上舍入一条记录中的数字,向下舍入另一条记录中的相同数字
- python - 在 Python3 中使用套接字发送图像
- react-native - 如何在 React Native 中正确测试 onScroll 事件值?
- mysql - 使用来自存储过程的值的触发器将值插入表中
- reactjs - 运行“amplify init”后初始化环境出错。
- python - 如何替换仅出现在单词边界的特殊字符
- javascript - 计算多个矩形的边界框(带和/或不带旋转)
- prolog - 如何将常量列表与变量列表进行比较
- r - `knitr::include_url` 在输出中被忽略