This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi! This is not an advertisement thread, but more of an advice thread... We all (well most of us I hope) find logging the best way to debug our web pages in the long run... So whic loggers do you use? I mean you can use the default logger, but the directory grows so huge and becomes no longer maintainable... So can you tell me what you guys use and more important WHY you use it? I've heard of log4j being popular... what makes it so popular? What about JLogger? What about Velocity (is it even a logger?)? I am asking this cause I am working on a logger that I myself could use... I am talking about http://ivjlogger.sourceforge.net/ So far I targeted: - Simplicity (achieved -1 line of code to init 1 line to log 0 to cleanup) - Performance (bckg thread pool with min priority threads... still work fast) - Maintability (monthly & yearly ZIP archives) - Maintability #2 (HTML logs that are easy to view) - Extensibility (extremely simple design & tutorial on how to extend it)
Can somebody suggest why would I use log4j? I've seen some apps that use it and they ahve external XMLs that configure it and stuff... do you really have to do that just to log some text? Please let me know what logger you use an why you use it...
Your previous advertisement for your personal logger project was also moved. When will you learn? P.S. it's typical spammer behaviour to start their messages with 'this is not an advertisement'. It no longer fools anyone. [ September 23, 2003: Message edited by: Jeroen Wenting ]
Be nice Atleast there is a questions and possible discussion associated with this one. It still has nothing to do with Servlets and is still likely to be moved, we just have to decide where. Dave
Joined: Jul 22, 2003
Jeroen Wenting you may look at it as advertisement but that's just you... Tell me WHY would I advertise something hosted by SF.net that I give you FOR FREE under GNU GPL license? Cause I want to make your life easier perhaps? Plus, my only true intention is LEARNING, and I don't see what's wrong about ripping off ideas from existing loggers and making them better... David O'Meara "logging is important. System.out is inappropriate in enterprise applications. I'm hoping this is a separate conversation"... I agree... I mean if your server has been running for years and you run through your log and you see an exception every time everybody tries to access "Superpage.jsp", you might suspect something is wrong... System.out just won't cut it... "I don't like logging directly to third party APIs - this means for a logger, we'll use our own Logging proxy that will delegate to a specific API." logging proxy? what the hell is taht? "I tend to default to log4j due to its granularity. You can't beat being able to log a single Class or sub-package at a time. Configuration is powerful but relatively easy too." What do you mean by granularity? And if by logging a class or sub-package you mean passing Object as a reference (not just String), then IVJLogger supports that... Although it simply calls that object's .toString(), you can easily write a filter as an annonymous class that'll do whatever you want with that object... And about the easy and powerful configuration... can you give me more on taht please? Thank you!
I would go for Log4J as well; it can be really tedious at times, but it does the job. And moreover, it's a standard (more or less anyway ) My ideal logger app would be something like Log4J Light. Just my $0.02
Logging to syslog is the typical way of doing things (in my world, anyhow). Log4J is an excellent way to do this, or a google search will give you about a dozen other libraries that will assist this. Since your application will *presumably* run on top of an OS, your logs will probably go under the user category. Simply refer to the Syslog specification as to where logs should go & what information to capture R
System.out just won't cut it... The biggest mistake I made (years ago, thankfully) was logging to System.out without seeing where it went - it was only going to the console. When I encountered an error that crashed the app, all logging was lost! You need to be able to control where your logging goes. logging proxy? what the hell is taht? You write your own Logging API, but it doesn't do anything execpt pass logging calls on to a third party logger. You write it with an adapter to each external logger so that you can configure which external logger you write to at runtime. This way, if you need to change loggers you don't need to rewrite all the method calls in your code, you just change the adapter. What do you mean by granularity? And if by logging a class or sub-package you mean passing Object as a reference (not just String), then IVJLogger supports that... Although it simply calls that object's .toString(), you can easily write a filter as an annonymous class that'll do whatever you want with that object... If you're producting a third party logger, you have to install and use log4J. It's almost an industry standard at the moment. You are aware that most loggers can be configured to log at different levels? debug, info, warning, error, etc. In log4J you can also configure logging at the class level. You write debugging into all your classes, but you configure what logging gets output to the log file at the class level. Meaning if you make class A error, only error logs from that class will be output, while class B can be set to debug, so all logging from that class gets output. And about the easy and powerful configuration... can you give me more on taht please? Related to the above. Dave