Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

log4j XML properties file problem.

 
Ranch Hand
Posts: 117
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hola,
Anything wrong with the question ??
 
Ranch Hand
Posts: 2308
  • 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
  • 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
  • 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
  • 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
 
drifter
Posts: 1364
  • 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.
 
This tiny ad is wafer thin:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!