• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

y this ClassCastException in log4j ?

 
Sangeetha Rao
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1364
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Carol...can u plz give me a link to mycat.bad file !!
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lott Carol
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic