You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2005/02/23 14:37:29 UTC

DO NOT REPLY [Bug 33708] New: - XML Configuration of loggerFactory does not work

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33708>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33708

           Summary: XML Configuration of loggerFactory does not work
           Product: Log4j
           Version: 1.3alpha
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Configurator
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: goncalo@ist.utl.pt


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,

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org