Skip to main content

How do I turn on file logging in Java Web Start on Java 6?

4 replies [Last post]
stegam
Offline
Joined: 2006-11-16

It's been a while since I've used Java Web Start, but I remember that in versions before Java 6 it was possible to log Java Web Start output to a file. I can't find that option anywhere in either the Java control panel or the Java Web Start control panel.

Does anybody know how I can enable file logging in Java Web Start when using Java 6?

Any help will be greatly appreciated.

Cheers,
Stephen.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
steevcoco
Offline
Joined: 2004-05-23

Well; no reply to my message. But: I did file a bug about the logging permission. It now has an id: 6519123. It may not yet be visible.

Any luck figuring out what you're looking for?

steevcoco
Offline
Joined: 2004-05-23

Hi.

I'm not sure what you are actually looking for... But: in my running version of JRE 6 (from Sun), launching the ControlPanel using JRE_HOME/bin/jcontrol I see a tab in the control panel's GUI labled "Advanced", and in that tab under "Debugging" is "Enable logging".

Is that what you were after? Or are you trying to use java.util.logging from a sandboxed Java Web Start app? In this case I am under the impression myself that the only way to use logging is to get permission: java.util.logging.LoggingPermission "control": and then configure a FileHandler for output. And the only permissions available to a sandboxed Web Start app is actually AllPermission, by including the tag in the JNLP file.

I also just stumbled over bug 6207335 which might possibly be your problem if you're doing Handler configuration in a properties file.

Otherwise: You have actually caused me to believe this is a bug. I filed a bug against java.util.prefs usage of the "preferences" permission: bug id 6500211. The problem there is that there is only this global permission, and it is checked immediately when you request a Preferences node; yet it is possible to implement Preferences using cookies/muffins in the sandbox: so that premission blocks you totally out of using such an implementation by just failing once it notices you're in the sandbox, but your implementation may just work within the sandbox. This logging permission comes under the same category: it would be possible to log to a server, or to a temp file, or a muffin if you wanted, but this permission will block you out before your implementation can get invoked.

Any help in any of this?

stegam
Offline
Joined: 2006-11-16

Hi,

Sorry about my tardiness in responding. I had found the Control Panel you mentioned, which partly achieve what I want. I modified the logger.properties files in the JRE/lib directories to have logs always written to the same file rather than a new one each time the logger is initialised, but for some reason that doesn't seem to work correctly - it still logs to a new file each time. I fully expect to find that I've done some wrong here.

I don't think my JWS application is sandboxed (although I'm not completely confident about this) as it is signed and I have a security/all-permissions entry in the JNLP file, so logging is sort of working.

You're observations are interesting although I must admit that I don't fully understand them as I'm not as experienced with JWS as you.

Thank you very much for your help, I really do appreciate it. I will be looking at the your response in a lot more detail very soon - once I've got a web start demo of my application working.

Regards,
Stephen.

steevcoco
Offline
Joined: 2004-05-23

Hi.

Oh boy! Now it's possible you are being bitten by the other bug I found: 6207335. It prevents Handlers from being configured correctly with properties files when Handler classes are not loaded by the system classloader, as may be the case running under javaws. If this is the case, then it's possible that the settings in that properties file are not getting loaded under javaws.

I'm not sure you can test this easily. The control panel makes settings for the plugin. You could try running your app from a normal main method without javaws (using the java launcher), and then do some logging yourself within your app. Then, make changes to the properties file, re-run, and see if the changes take effect. Now run it under javaws with this logging you're doing yourself, and again make changes to the properties file and re-run. If you find that changes to that properties file do change the output behavior of your logs when running from the java launcher, but when running under javaws they do not, then this bug is affecting you when you run under javaws. It might be useful if you added a short comment to that bug about the fact that you're modifying the default properties file and javaws cannot load it.

But on the other hand it is also possible that javaws -- or actually the plugin -- is simply configuring these handlers manually instead of relying on the defaults from the properties file. So it won't matter what you put in that file since the plugin just manually configures the handlers itself. But this seems less likely since it would defeat a lot of the utility of that file.

I'm working on a javaws app now. I'll see if I can keep this in mind and give a quick test myself.

And on your comment about the security permissions: if you are able to configure a Logger Handler from your own code while running under javaws, then you do indeed have AllPermission. That must be true since as I've said, that's the only permission set you can grant in javaws, and configuring Logger Handlers requires permissions that are not available in the default sandbox. --- Unless you also have a custom security file in this JRE.

Anyway, good luck.