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 Ceki Gülcü <ce...@qos.ch> on 2002/06/10 18:41:13 UTC

Re: ClassCastException when I extend Logger

Extending the Logger class is strongly discouraged.

Anyway, the examples file mycat.good had a mistake. I have attached a 
corrected version. Try it first before continuing.

HTH,

At 17:18 10.06.2002 -0700, you wrote:

>Hi
>I have extended org.apache.log4j.Logger and have implemented the
>loggerfactory interface.
>(When I say that I did this...I mean that I copied the examples and maed a
>few minor changes!)
>My xml configuration file looks like
>
><?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE log4j:configuration SYSTEM "D:\logs\log4j\log4j.dtd">
><log4j:configuration debug="true"
>xmlns:log4j="http://jakarta.apache.org/log4j/">
>  <appender name="A1" class="org.apache.log4j.DailyRollingFileAppender">
>   <param name="File" value="D:/logs/generalLog.xml"/>
>   <layout class="my.log.MyLayout">
>    <param name="ConversionPattern" value="%m"/>
>   </layout>
>  </appender>
>  <appender name="ServiceLogFile"
>class="org.apache.log4j.DailyRollingFileAppender">
>   <param name="File" value="D:/logs/serviceLog.xml"/>
>   <param name="DatePattern" value="'.'yyyy-MM-dd"/>
>   <layout class="my.log.MyLayout">
>    <param name="ConversionPattern" value="%m"/>
>   </layout>
>  </appender>
>  <category name="my.log.Test" additivity="false"class="my.log.MyLogger">
>   <level value="info"/>
>   <appender-ref ref="ServiceLogFile"/>
>  </logger>
>
>
>  <root>
>   <priority value="info"/>
>   <appender-ref ref="A1"/>
>  </root>
>  <categoryFactory class="my.log.MyLoggerFactory"/>
></log4j:configuration>
>
>I am getting a ClassCastException when I try to get an onstance of my logger
>class.
>
>I have looked at the examples provided in the examples\subclass directory.
>I even imported them into my IDE and ran the test with "mycat.good". This
>also gives a ClassCastException.
>
>Am I missing sometyhing silly! I have been going stir-crazy looking at this.
>Can anybody offer a suggestion?
>
>Thanks you
>S

--
Ceki

SUICIDE BOMBING - A CRIME AGAINST HUMANITY
Sign the petition: http://www.petitiononline.com/1234567b
I am signatory number 22106. What is your number?