File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j XML properties file problem.

 
Mike Anna
Ranch Hand
Posts: 117
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I wanted a simple thing from my application. Seperate levels of logging should be logged in seperate files. I did post about this in one another place tho. After a lot of readin, I figrured that filters can only be used in an XML file I made an XMl file and a java class to test it. Alas, I am still getting errors. here are the details :


********************************************************

Heres my java file :
*********************

********************
heres the XML configuration:
*********************

Could some body please tell what wrong am I doing here ?

thanks in advance for your time spent
 
Mike Anna
Ranch Hand
Posts: 117
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hola,
Anything wrong with the question ??
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.lang.ClassNotFoundException: org.apache.log4j.PatternLayout


The runtime is not finding org.apache.log4j.PatternLayout in the classpath.

Is log4j-x.x.jar present in the classpath during runtime ?
 
Mike Anna
Ranch Hand
Posts: 117
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is log4j-x.x.jar present in the classpath during runtime ?

Yes it is. Logging as such works fine if I use a simple properties file and append all levels into one single file. Of course,thats not what I want. Since filters are the only way I can append into different files, and filters are possible only with an xml file. I am using the above, and having problems
Has anyone tried to do this (seperate levels of logs into seperate log files)? If yes please let me know the approach for this.
thanks in advance
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is that giving java.lang.ClassNotFoundException: org.apache.log4j.PatternLayout if the classes are present in the classpath ?
 
Mike Anna
Ranch Hand
Posts: 117
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is that giving java.lang.ClassNotFoundException: org.apache.log4j.PatternLayout if the classes are present in the classpath ?


Good Question. Just that .. I dont know.
May be I will do a fresh download and set afresh the classpath.
Could some body use this code on their machine and let me know if it works there. I am still stuck with this without any clue.
Please help.

TIA
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, it's not finding "org.apache.log4j.PatternLayout " in the classpath....notice the SPACE in quotes after PatternLayout.

Notice that there are several of those mis-configurations in your xml file.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic