我正在为我的项目使用log4j。当我使用jar时,它无法正常工作。当我将vm arg -Dlog4j.debug=true
添加到我的调试配置中时,我得到了这个 -
log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@644d46.
log4j: Using URL [jar:file:/C:/Users/modia1/.m2/repository/ca/uhn/hapi/hapi-hl7overhttp/2.2/hapi-hl7overhttp-2.2.jar!/log4j.xml] for automatic log4j configuration.
log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator
log4j: System property is :null
log4j: Standard DocumentBuilderFactory search succeded.
log4j: DocumentBuilderFactory is: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
log4j: debug attribute= "null".
log4j: Ignoring debug attribute.
log4j: reset attribute= "false".
log4j: Threshold ="null".
log4j: Level value for root is [debug].
log4j: root level set to DEBUG
log4j: Class name: [org.apache.log4j.ConsoleAppender]
log4j: Parsing layout of class: "org.apache.log4j.PatternLayout"
log4j: Setting property [conversionPattern] to [%d{ABSOLUTE} %5p [%t] %c{1}:%L - %m%n].
log4j: Adding appender named [stdout] to category [root].
但我已将log4j属性文件放在src / main / resources&项目文件夹。但它仍然使用其他一些记录器配置。如何让它使用我的属性文件?
答案 0 :(得分:0)
您应该将log4j.xml或log4j.properties放在以下路径中:
/ yourapp / SRC /主/爪哇/
请您在项目的文件层次结构上发布截屏?