Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2005

Tip: Looking for answers? Try searching our database.

Logger Performance

Thread view: 
Kenneth P. Turvey - 19 Sep 2005 04:39 GMT
I was looking at the Logger classes the other day and I read some claims
about the performance of the Logger that I found a bit hard to believe.

Ideally what one would like is a system like the assertion system where
logging code is only executed when it is above the level being filtered
by the logging system so code like this:

thisLogger.finest("My info: " + SomeObject.performComplexCalculation());

would not execute except when the user was requesting logging at the
finest level.

I don't believe the Logger is handled this way.  It would require
compiler support that I don't believe exists, wouldn't it?

Am I correct in understanding that logging should not be used in inner
loops, even for debugging (if it will be in the code in production)?

Thanks.

- --
Kenneth P. Turvey <kt-usenet@squeakydolphin.com>
http://kt.squeakydolphin.com (not much there yet)
Jabber IM: kpturvey@jabber.org
Phone: (314) 255-2199

(If you've seen this message once before, I apologize.  I canceled the
wrong one.)
EricF - 19 Sep 2005 05:41 GMT
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
[quoted text clipped - 27 lines]
>(If you've seen this message once before, I apologize.  I canceled the
>wrong one.)

I don't know about the Sun JDK logger class but log4j has boolean methods like

if (logger.isDebugEnabled())
..

I didn't check the docs so the code fragment may not be 100% correct but you
should get the idea.

Eric


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.