File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes jdk 1.4: when does the logging shorthand fail ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "jdk 1.4: when does the logging shorthand fail ?" Watch "jdk 1.4: when does the logging shorthand fail ?" New topic
Author

jdk 1.4: when does the logging shorthand fail ?

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
In sun's sdk 1.4 documentation on logging, they say:
"void warning(String msg);
For this second set of methods, the Logging framework will make a "best effort" to determine which class and method called into the logging framework [...]. However, it is important to realize that this automatically inferred information may only be approximate. The latest
generation of virtual machines perform extensive optimizations when JITing and may entirely remove stack frames, making it impossible to reliably locate the calling class and method. "
so, when is this short version reliable ? is it only problematic with JIT compiler or are there other critical issues ?
if detecting the method is not reliable, where's the point of this framework at all ?
thank y'all
dennis
Thomas Smets
Ranch Hand

Joined: Dec 11, 2001
Posts: 111
Dennis,
Be professionnal use Log4J. It's a technology from I.B.M. given in GPL ... What else do you want ?
Thomas,


Thomas Smets
Just another developper
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Dennis,
the framework is just giving you the choice: Either do some more work and get the most precision, or use the automated mechanism and live with the potential impreciseness.
Thomas,
are you implying that using the JDK1.4 logging framework would be nonprofessional???


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
thanks guys !
gonna use log4j
dennis
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Dennis K�hn:
gonna use log4j

Aha, why?
Please notice that log4j doesn't seem to give you the option to explicitely name the source of a log event, so it always works in the imprecise mode that the JDK1.4 mechanism gives you as an option.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
seen from this point, you're right.
The company I work for has just managed to make their way to jdk 1.3. It will be at least one more year until 1.4 will be a strategic release here.
I would have extracted the logging from the 1.4 runtime jar, but it doesn't work (can't recompile it under 1.3) because sun, who are getting as nasty as M$, "forgot" to include them sun.reflect sources in the 1.4 src, which are required for the logging to work.
instead of adapting all that shid and still not having method names logged, it takes less to just use a 3rd party product and use clear ifaces where application and logging controls meet the actual logging mechanism, so i still can change easily to the 1.4-built-in jdk logging.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
There seems to be an open source implementation of the java logging framework for JDK1.2: http://sourceforge.net/projects/javalogging/
Might be worth a look.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
yep- that seems great to me. having the same interface before and after jdk 1.4 is of great value !
thanks for the hint !
greetz
dennis
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jdk 1.4: when does the logging shorthand fail ?
 
Similar Threads
Getting the current Class name and Method name
Logging events with java.util.logging.Logger
About Exception, Throwable and log files.
Shared Libraries & Logging
Method Class