• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet Logging

 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Balaji Loganathan
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic