Hello.
I am working with log4j version 1.2.9.

I am trying to subclass a logger with my own logger (because I want it
to accept varargs style logging, for example debug("hello",new
Integer(1), "Hello"); )

I managed to get it working but, and this is weird, only when
configuring the logger by log4j.properties.

I'm using the following configuration:
log4j.debug=true
log4j.loggerFactory=logging.VarArgsLoggerFactory
log4j.rootLogger=DEBUG, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%5p [%t] %c - %m%n

With this, it works greate.

However, if I try to use the following xml configuration (log4j.xml):
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/";
debug="true">
 <appender name="ConsoleAppender"
class="org.apache.log4j.ConsoleAppender">
   <layout class="org.apache.log4j.PatternLayout">
        <param name= "ConversionPattern" value= "%5p [%t] (%F:%L) - %m%n"/>
   </layout>
 </appender>
 <logger name="some.cat">

       <level value="debug"/>
       <appender-ref ref="ConsoleAppender"/>
 </logger>
<categoryFactory class="logging.VarArgsLoggerFactory"/>
</log4j:configuration>

I get a "ClassCastException" error, due to the erroneous processing of
the "categoryFactory" element.

I was debugging the DOMConfigurator class and I found out that, at
line parseCategoryFactory the class is perfectly instanteated but
nothing is done with it !
On the other hand, on PropertyConfigurator I found out that, on line
459 there is the following statement:
PropertySetter.setProperties(loggerFactory, props, FACTORY_PREFIX + ".");

which I thing that updates the configuration.

In resume, I think that DOMConfigurator must update the cat variable
in the parseCategoryFactory method (as it does for the other
configuration elements).
Is this resolved in the latest version of Log4j ?

Please help me, I really need to get this working.

Plus, can anyone provide me an actual log4j.dtd?

Thank you very much,
--
Gon�alo Luiz


-- 
Gon�alo Luiz

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

Reply via email to