You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Mark Evans (Anaheim)" <me...@Printrak.com> on 2001/12/17 23:19:09 UTC

Help on XML config files

I hope I'm posting this right!

I've dorked around all day trying to get an xml configuration file working.
It complains about not finding a root element.  The documentation on the XML
configuration file is weak at best.  (Only a few examples, all the same.)

I want to send output to stdout and to a log file (simple enough).

Below is what I get.  Any help would be greatly appreciated!

--Mark


Here's what I get:

root_ptkomni.printrak.com# java -classpath `local_jars`
-Dlog4jConfigFile="log4j.xml" -Dlog4j.debug test
log4j: Trying to find [log4j.properties] using
sun.misc.Launcher$AppClassLoader@80045e0 class loader.
log4j: Using URL
[jar:file:/ActiveFiles/omnitrak_server/jboss/client/jbossmq-client.jar!/log4
j.properties] for automatic log4j configuration.
log4j: Reading configuration from URL
jar:file:/ActiveFiles/omnitrak_server/jboss/client/jbossmq-client.jar!/log4j
.properties
log4j: Parsing for [root] with value=[ERROR, stdout].
log4j: Priority token is [ERROR].
log4j: Category root set to ERROR
log4j: Parsing appender named "stdout".
log4j: Parsing layout options for "stdout".
log4j: Setting property [conversionPattern] to [%5p [%t] (%F:%L) - %m%n].
log4j: End of parsing for "stdout".
log4j: Parsed "stdout" options.
log4j: Finished configuring.
log4j: Could not find root category information. Is this OK?  <------ HERE'S
MY PROBLEM!!!!
log4j: Finished configuring.
hello
test()
x:stuff
Done.
# cat log4j.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>

        <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
                <layout class="org.apache.log4j.PatternLayout">
                        <param name="ConversionPattern" value="%d [%t] %-5p
%c - %m%n"/>
                </layout>
        </appender>

        <appender name="A1" class="org.apache.log4j.FileAppender">
                <param name="File" value="log4j.log"/>
                <layout class="org.apache.log4j.PatternLayout">
                        <param name="ConversionPattern" value="%d [%t] %-5p
%c - %m%n"/>
                </layout>
        </appender>

        <root>
                <priority value ="debug" />
                <appender-ref ref="stdout" />
                <appender-ref ref="A1" />
        </root>

</log4j:configuration>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>