This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of DevSecOps Adventures: A Game-Changing Approach with Chocolate, LEGO, and Coaching Games and have Dana Pylayeva on-line!
See this thread for details.
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Java Util Logging

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

i am using java util logging. in that i need to know abt

 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will use isLoggable() to avoid calling heavy logging process, which could have an impact on performance. For example, looping through a List and logging its content. You want to do it only if the logging level is lower than the level you are using.
[code]
Logger logger = Logger.getLogger("com.mycompany.MyClass");
if (logger.isLoggable(Level.FINEST)) {
for ( int i = 0; i < biglist.size(); i++ ) {
// loop through the list and do some other logging stuff. May take a few minutes
...
}
}
[code]

You don't need to use isLoggable() if the logging does not impact on performance. So in your case logger.finest("count: "+count); is ok.
You will have to set the logging level in a property file, which will determine of the "count" will be logged or not.
 
Srinivas Raghu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You for Your Reply
 
Srinivas Raghu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I need to configure like log4j using util.logging.

For that, reading the logging.property file for my own application
usage (copied from jre/lib ). i need how to code for reading from that
file. "readConfigure" example i need.

also i need how to create -> currentdate.log file for each day
automatically.

Thank You.
 
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic