You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Alvin Wong <al...@spanlink.com> on 2004/12/23 22:55:46 UTC
XML cfg entries for custom levels
Hi
I've create a custom level, SLevel, similar to one defined in tests/src/xml/xlevel.h. However, when I tried to get this new level to work, log4cxx cannot find my class. Below are some settings I tried and the error returned. I'm using log4cxx 0.9.7.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="true" 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 %X{Fcn}: %m%n"/>
</layout>
</appender>
<root>
<level value="dump" class="org.apache.log4j.xml.SLevel"/>
</root>
</log4j:configuration>
Threshold ="null".
Level value for root is [DUMP].
Desired Level sub-class: [org.apache.log4j.xml.SLevel]
Could not create level [DUMP]. Reported error follows.
Class 'org.apache.log4j.xml.SLevel' not found
and if I replace the class=="org.apache.log4j.xml.SLevel" with class="com.spanlink.util.log.SLevel" I get:
Threshold ="null".
Level value for root is [dump].
Desired Level sub-class: [com.spanlink.util.log.SLevel]
Could not create level [dump]. Reported error follows.
Class 'com.spanlink.util.log.SLevel' not found
Note that the second way works with log4j for my custom level implemented in Java. Can you tell me what I should put in the cfg file?
Thanks,
-Alvin
Re: XML cfg entries for custom levels
Posted by Curt Arnold <ca...@apache.org>.
It is not a facility that I have used, but it is tested in the unit
tests by tests/src/customlogger/xloggertestcase.cpp.
I compared your config file with the tests/input/xml/customLogger1.xml,
the config file for that test and didn't see any significant
differences.
I believe the more likely problem is a registration failure of the
level class. You might try comparing your level class with
tests/src/xml/XLevel.cpp which implements two additional levels
"lethal" and "trace" used in the unit tests and see if you might have
missed some registration macro.