• 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Good logging system for WebApp (Struts)

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is that: How to get the Logger for my webapp ? I have designed 3 cases:

case 1:
Getting a private static logger of each classes. As there are many StrutsAction classes, it seems the code is not tidy.



case 2:
Write a single Logger common to the package, and ALL classes within the webapp will use this logger for logging.


case 3:
Same as case 2, except I initialize a Logger during the SerletContext Initialization and put this as ServletContext attribute, then all StrutsAction class get the logger from Servlet Context during runtime.



Thus, prevent from using a static logger which is hardcoded in the StrutsAction class. However, I doubt if any significant overhead is added in the system.


Could any expert share your experience about this ?

Thanks
 
Vince Hon
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
additional info of my webapp:

I am now designing a logging system for my webapp which is based on Apache Struts framework.

To avoid using System.out.println() for logging, I use the J2SE java.util.logging tools.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Vince, why don't you use a Filter?
That, and with Log4j will let you do about anything ya need.
 
That's a very big dog. I think I want to go home now and hug this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!