2014-07-23 96 views
0

我正在爲我的項目使用log4j。當我使用罐子時它不工作。當我加入了虛擬機ARG -Dlog4j.debug=true我的調試配置,我得到了這一點 -Log4j無法正常工作

log4j: Trying to find [log4j.xml] using context classloader [email protected] 
    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 /資源&項目文件夾中。但它仍然使用其他一些記錄器配置。我怎樣才能使用我的屬性文件?

+0

您可以將屬性文件放在'/ resources'目錄中。 –

回答

0

你應該把的log4j.xml或log4j.properties以下路徑下:

/yourapp/src目錄/主/ JAVA/

可以請你張貼的文件層次的屏幕截圖項目?

+0

http://imgur.com/XKEwg8R –

+0

這是你的問題,你應該把log4j.xml放在src :) – mkazma

+0

我使用的是log4j.properties文件,而不是xml。你的意思是src/main/java? –