Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Error setting up Logging

 
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an error on the logging on this code snippet. I have not set up log4j. Can someone please direct me to a resource for setting up log4j into a dynamic web project in Eclipse Juno or similar IDE?

 
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can access log4J v1.2 here and the short intro

Basically download the jar put it in your web app WEB-INF/lib
in your Java code import those libraries and add line similar to
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:


Thanks a lot! I think I have a handle on this now, however, I need to know the following:

What is the most recent release of Log4J?

I went out and looked around and noticed this: http://logging.apache.org/log4j/2.x/download.html

I would like to download a stable release, not a beta version of the jar.

Thanks,
Michele
 
K. Tsang
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The stable version would be v1.2 (link provided earlier).
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Thank you for the clarification, it was not super clear from looking at the Apache Log4J pages. I did notice the project I inherited had two Log4Js in the lib folder of the web project, one which is log4j-1.2.13 and one which is log4j-1.2.15. I noticed the one you referred me to is log4j-1.2.17. When I removed 13 and 15 and put 17 in, it broke the entire application, referring to DWR.

Direct Web Remoting.

I guess I need to look at the Direct Web Remoting to figure out what is happening there.

In general, however, what is your opinion on having 2 different log4js in the lib folder, the log4j-1.2.13 and the log4j-1.2.15, the project builds with it? The current build I inherited has these two in it. Also, with a web project, does the log4j.properties create an empty folder called Log4J in the Web application? Or, do I need to put an empty folder into the web project for the logs to be archived?


So the content of log4j.properties file would be as follows:
# Define the root logger with appender file
log = /usr/home/log4j
log4j.rootLogger = DEBUG, FILE

Last but certainly not least, you directed me to this page: http://logging.apache.org/log4j/1.2/download.html, and when I went there, I found the .jar 17 but I found a lot of other things as well. In general, what are the basic requirements for using Log4J?

Thanks,
Michele
 
K. Tsang
Bartender
Posts: 3648
16
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I don't know why you need 2 log4j jars in your project. The only thing I do know is that the latest log4j uses Java 6 (not sure if this actually applies for v1.2). Older version may be compatible with Java 5 or even 4. Yet I don't seem to find this "what Java version is needed" on the website.

From my experience if indeed 2 jars are present, the newer is used.

FYI DWR default loggin implementation uses Apache commons logging but since it already uses log4j, maybe its the config files.
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic