Two Laptop Bag*
The moose likes Other Open Source Projects and the fly likes Log4J Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Log4J" Watch "Log4J" New topic
Author

Log4J

Allan Moster
Ranch Hand

Joined: Sep 14, 2001
Posts: 153
System.out has been our way of debugging our JSP pages. The result is always polluted source codes. Does anyone here use Log4J? Can you share your experience? Pros and Cons?
Thanks.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Yes, I've used it on a couple of projects and I LOVE it. I'm recommending it for every project now.
The coolest features are the way it automatically "filters" levels of what goes to output without having to put that in your code, and the ability to go to multiple destinations (files, sockets, etc....)
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Allan Moster
Ranch Hand

Joined: Sep 14, 2001
Posts: 153
Hi Kyle,
I've created a new project in VisualAge called Log4J and imported the log4j.jar into this new project. It complained that there's a problem with the SMTPAppender class. Did you encounter this?
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
My guess is that you need to import Sun's javamail classes... I generally have them in another project too, so I haven't seen this yet.
I doublechecked in my VAJ workbench and just confirmed that this is true -- you get the error if you remove the Javamail classes, but it disappears if you re-add them.
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
[This message has been edited by Kyle Brown (edited November 17, 2001).]
Allan Moster
Ranch Hand

Joined: Sep 14, 2001
Posts: 153
Thanks Kyle for you help. I played with it last weekend and wow, it is pretty good! Instead of using System.out to print out info messages I can now use these five methods: logDebug, logInfo, logWarning, logError, and logFatal. My config file sets up which files are being logged to, and what severity of messages are being logged. Really cool!
The only problem now is how to sell this idea to the rest of the team. Can i say that this is the de-facto standard now in the industry?
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Well, I wouldn't say it's the "defacto standard" but it sure is commonly used. I've seen it in dozens of projects at large companies. Just jump on the mailing list and look at the addresses users post from!
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
If you are going to use Log4J on a jsp page then you really neeed to get the Loggin TagLib. With that you don't write scriptlets to log a message you just put in a tag like < log:debug message="this is a message"/> It also has a tag that allows quick Dumping of all variables in a given scope to the log file.


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

Any link for Log4J for Windows platform(i use win2k server)?

------------------
Muhammad Ashikuzzaman (Fahim)
Sun Certified Programmer for the Java� 2 Platform
--When you learn something, learn it by heart!


Ashik Uzzaman
Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
There is no difference between Log4J on Windows or any other platform -- it's 100% pure Java. The Log4J Home Page gives you more information on downloading it.
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Although it may not be pervasive enough to be called the de facto standard, it probably is the most popular logging solution after System.out. To convince your colleagues you might point out that it was a major inspiration behind the Java 1.4 Logging API. Indeed, the resemblance is striking.
- Peter
 
Don't get me started about those stupid light bulbs.
 
subject: Log4J