At 03:43 PM 10/3/2003 +0000, you wrote:
I am having problems getting log4j to configure from an XML file.
When I use the xml file shown below, i get the following warning in
java (1.4.1_02). Note: When I use a non-XML properties file it works
just fine.

log4j:WARN No appenders could be found for logger
(edu.jhuapl.latency.GNCSTlatencylog4j).

log4j:WARN Please initialize the log4j system properly.

Any ideas? Thanks in advance.

Try removing all appenders except for the console appender from the <root> logger and see it works. Reducing the extraneous variables will help pinpoint the problem more efficiently. Also, I assume you had put log4j.properties in the classpath and let log4j load it automatically. I imagine you did the same for log4j.xml. I think Log4j loads properties files preferentially to XML files (I could be wrong here). Given that, it is possible that there were no other log4j.properties files in the classpath other than yours, but there may have been another log4j.xml file in the classpath that might be overriding yours. That's just a shot in the dark as to why it worked with the properties file and not the XML file.


BTW, you should use <level> rather than <priority>.

Jake


Here is the xml file
---------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/";
                           debug="true">

<!-- Console Appender -->
        <appender name="stdout"
class="org.apache.log4j.ConsoleAppender">
                <layout class="org.apache.log4j.PatternLayout">
                     <param name="ConversionPattern"
                            value="%d{ISO8601} %-5p %C{2} [%t] (%F:%
L) - %m%n"/>
                </layout>
        </appender>

<!-- Rolling file Appender -->
        <appender name="R"
class="org.apache.log4j.RollingFileAppender">
                <param name="File" value="log/gncst.log"/>
                <param name="MaxFileSize" value="1000KB"/>
                <param name="MaxBackupIndex" value="5"/>
                <layout class="org.apache.log4j.PatternLayout">
                     <param name="ConversionPattern"
                            value="%d{ISO8601} %-5p %C{2} [%t] (%F:%
L) - %m%n"/>
                </layout>
        </appender>

<!-- LogFactor5 appender -->
        <appender name="LF5_CLIENT"
class="org.apache.log4j.lf5.LF5Appender">
                <param name="MaxNumberOfRecords" value="1000"/>
        </appender>

<!-- JDBC Appender -->
        <appender name="JDBC"
class="org.apache.log4j.jdbcplus.JDBCAppender">
                <param name="url"
value="jdbc:oracle:thin:@tofu:1521:gncst"/>
                <param name="username" value="gdba"/>
                <param name="password" value="gdba"/>
                <param name="sql"
                       value="INSERT INTO latency_log
(LATENCY_IDENTIFIER, EVENT, COMPONENT, PROCESSING_LEVEL,
SECURITY_LEVEL, MESSAGE, TIMESTAMP) VALUES (@LATENCY_IDENTIFIER@,
@EVENT@, @COMPONENT@, @PROCESSING_LEVEL@, @SECURITY_LEVEL@,
@MESSAGE@, @TIMESTAMP@)"/>
                <param name="buffer" value="1"/>
                <param name="commit" value="Y"/>
                <layout class="org.apache.log4j.PatternLayout">
                     <param name="ConversionPattern"
                            value="%d{ISO8601} %-5p %C{2} [%t] (%F:%
L) - %m%n"/>
                </layout>
        </appender>

<!-- Root debugger -->
        <root>
                <priority value="debug"/>
                <appender-ref ref="stdout"/>
                <appender-ref ref="R"/>
                <appender-ref ref="LF5_CLIENT"/>
                <appender-ref ref="JDBC"/>
        </root>

</log4j:configuration>




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to