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.
The moose likes Servlets and the fly likes Query on Logging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Query on Logging" Watch "Query on Logging" New topic

Query on Logging

Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
Log files are like a heaven when any application goes live .

So is there any good solution available for logging.
At present what i do , when ever any method is invoked in a servlet or a java code , i'm logging a message like "Came into getCustInfo() with parameters .. ... ..." and some processed results, is there any better solution, that makes the application support maintenance easier.


Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1082

Dear srini

IO Operation are very costly for the performance of an application.

If you are using your own logger for your application then I will recomend to keep varios level of log.

try using log4j or java.util.logging API

If Still you want to carry on with ur logger implement the various level functionality.

earlier to log4j I used to use my own logger having 6 level like Info, Debug, Exception etc and there were respective method for same which can be enabled /disabled by flags in xml file.

hope this answer your query

Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
How many levels does java.util.logging API has ?
Nitin Dubey
Ranch Hand

Joined: Oct 30, 2000
Posts: 126


Logging is essential for the application and the performance of the application too. Sometimes we have to do a lot of logging in our application to track down the exact problems. Log4J today is the most popular logger component used and is said to be one of the best as far as performance is concerned.

I am curious to know the reasons for log4j being performing better than any custom made component. What makes Log4J log messages faster than other components ?


Nitin Dubey
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1082

there are 7 levels in java.util.logging those are but i never used any


I am using log4j for my application.
Senthil B Kumar
Ranch Hand

Joined: Feb 09, 2004
Posts: 160
Its true that Log files are Heaven, when an application goes to production. But the second part is, after some time in production, it should be taken care that these Log files dont become a HELL.

ya, IO operations are very costly which may directly degrade the performance of your application.

so use widely accepted tools like Log4j, which has different levels of logging and you can control which level should be logged, what should the threshold file size should be. What should be done when the file size reaches the threshold limit..etc

As thumb of rule, Dont try to re-invent the wheel.

Work like you don't need the money. Love like you've never been hated. Dance like nobody's watching. Sing like nobody's listening. Live like it's Heaven on Earth.
Currently I Reside Here WEBlog
I agree. Here's the link:
subject: Query on Logging
It's not a secret anymore!