Forums Register Login

Java Util Logging

+Pie Number of slices to send: Send
Hi all,

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

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Thank You for Your Reply
+Pie Number of slices to send: Send
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.
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 646 times.
Similar Threads
Strange behaviour of MDB and EJB
Removing loggers from logger hierarchy in java util logging
Java logging API
problem with java logging
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:05:28.