File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes y this ClassCastException in log4j ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "y this ClassCastException in log4j ?" Watch "y this ClassCastException in log4j ?" New topic
Author

y this ClassCastException in log4j ?

Sangeetha Rao
Greenhorn

Joined: Jul 26, 2005
Posts: 1
I have a class called MyApp in LoggerPkg package. It has this line: private final static MyLogger logger =(MyLogger) MyLogger.getLogger(MyApp.class.getName()); MyLogger extends Logger.It has getLogger method that returns Logger object based on the LoggerFactory object. Now in the properties file if I have this line: "log4j.logger.LoggerPkg.MyApp=debug, A1" it shows the exception java.lang.ClassCastException on the line in MyApp. If I have only the rootLogger in the properties file, I dont get this Exception. Can anybody say y ASAP??
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
I haven't tried it, but I found a note in log4j example src MyLoggerTest.java to try config files mycat.bad and mycat.good.

mycat.good snippet:
Sangeetha Rao
Ranch Hand

Joined: Aug 01, 2005
Posts: 33
Thanks Carol...can u plz give me a link to mycat.bad file !!
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
In my log4j 1.2.9 dir "logging-log4j-1.2.9" it's in the examples directory.

mycat.bad:


mycat.good:

Sangeetha Rao
Ranch Hand

Joined: Aug 01, 2005
Posts: 33
Thanks a lott Carol
 
 
subject: y this ClassCastException in log4j ?