Weblogic 11g log4j:WARN请正确初始化log4j系统

时间:2014-11-11 07:45:03

标签: logging log4j weblogic slf4j ibatis

我使用log4j和weblogic 11g版本,我在服务器控制台中得到以下错误

log4j:WARN No appenders could be found for logger (org.apache.wicket.protocol.http.pagestore.FileChannelPool).
log4j:WARN Please initialize the log4j system properly.

我使用以下服务器启动

-Dlog4j.configuration=/apps/users/projects/domains/java_domain/log4j.xml

我的log4j.xml是

<!DOCTYPE log4j:configuration SYSTEM "D:/Java/apache-log4j-1.2.15/src/main/resources/org/apache/log4j/xml/log4j.dtd" >
<log4j:configuration> 
<!--  Appenders -->
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%5p %d{ISO8601} [%t][%x] %c - %m%n" />
    </layout>
</appender>

<!--  Loggers for ibatus and JDBC database -->
<logger name="java.sql.PreparedStatement" additivity="false">
    <level value="debug"/>
</logger>
<logger name="java.sql.Connection" additivity="false">
<level value="debug"/>
</logger>
<!--  The Root Logger -->
<root>
    <level value="error"/>
    <appender-ref ref="stdout"/>
</root>

</log4j:configuration>

服务器控制台中的预期结果是这样的

2014-07-03 18:00:34,154 [java.sql.ResultSet] DEBUG - {rset-100060} Header: [ID, PERSON_NAME, BIRTH_DATE, GENDER, EMAIL]
2014-07-03 18:00:34,154 [java.sql.ResultSet] DEBUG - {rset-100060} Result: [1600, MARK, 1980-11-18, M, null]
2014-07-03 18:00:34,154 [java.sql.ResultSet] DEBUG - {rset-100060} Result: [2032,STEVEN, 1980-10-18, M, null]
2014-07-03 18:00:34,154 [java.sql.Connection] DEBUG - {conn-100061} Connection
2014-07-03 18:00:34,154 [java.sql.Connection] DEBUG - {conn-100061} Preparing Statement:select ID, EMAIL, MOBILE,TELEPHONE_NUMBER from USER

我必须使用iBatis来打印SQL语句,但是如果你在控制台中看到WARN,我会看到 org.apache.wicket.protocol.http.pagestore.FileChannelPool 打印。我也在我的应用程序中使用wicket框架

log4j:WARN No appenders could be found for logger (org.apache.wicket.protocol.http.pagestore.FileChannelPool).

我也尝试将log4j.xml放在 WEB-INF / classes 中,但它没有用。

任何帮助都将更有用

感谢。

0 个答案:

没有答案