aspose file tools*
The moose likes Servlets and the fly likes Servlet Logging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Logging" Watch "Servlet Logging" New topic
Author

Servlet Logging

Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Hi,
I found Velocity and FOP processor were using a logging system from jakarta avalon framework.
For example, the "forumdemo" example in velocity package is using a logging system called
Jakarta Avalon Logkit logger(not sure).This logging looks nice !.
I would like to do the same for my Servlet,something like a file based runtime logging which updates all the current logging information like error,info,debug etc.,
Is it possible to do so ?
If so can anyone give me some code snippets or some links.
Regards
Balaji


Spritle Software Blogs
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
It seems in velocity the logging initialization is done at loadConfiguration(ServletConfig config ) method.
is it possible to do the same for servlet at some methods
ben munoz
Greenhorn

Joined: Jul 24, 2001
Posts: 5
I can tell you how I use file based logging for my servlets. I use Log4J from http://jakarta.apache.org/log4j
There are several ways to use this package. First, import the necessary classes.

Then create a class variable for this logging object.

In your servlet's init() method, configure the logger.

In your doPost() and doGet() methods, you can send very detailed debug or error messages.

The log4j classes are well documented and easy to use. They are a valuable tool for servlet/DB developers and well worth learning.
-Ben
Panagiotis Varlagas
Ranch Hand

Joined: Nov 27, 2000
Posts: 233
What about the Logging API in 1.4? Do you feel it will render logging mechanisms such as log4j or the ones provided by the app servers obsolete or is there more in those mechanisms that are not covered by the 1.4 API?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Servlet Logging