Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Query on Logging

 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Srini
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How many levels does java.util.logging API has ?
Srini
 
Nitin Dubey
Ranch Hand
Posts: 126
Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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 ?

Regards,


Nitin Dubey
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there are 7 levels in java.util.logging those are but i never used any

1. SEVERE
2. WARNING
3. INFO
4. CONFIG
5. FINE
6. FINER
7. FINEST

I am using log4j for my application.
 
Senthil B Kumar
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic