| Determine debug mode [message #72504] |
Thu, 24 August 2006 03:27  |
|
Originally posted by: stepper.sympedia.de
Hi,
I'd like to set some values in my code depending on whether the platform is in debug mode or not. To describe the background: My application works with timeouts and it'd be cute to automatically let them never expire while debugging the application.
I tried to call Platform.inDebugMode(), but it always returned false.
Then I tried to query the EnvironmentService with the same result.
The system properties never contain "osgi.debug=true" or "-debug".
Have I missed something?
Cheers
/Eike
|
|
|
| Re: Determine debug mode [message #72543 is a reply to message #72504] |
Thu, 24 August 2006 04:15   |
|
Originally posted by: stepper.sympedia.de
Currently I work around with the following:
public static final boolean DEBUG_MODE = !System.getProperty("java.vm.info", "").contains("sharing");
But I'm not sure if the result will be correct in all circumstances.
Platform.inDebugMode() would be nicer.
Cheers
/Eike
Eike Stepper schrieb:
> Hi,
>
> I'd like to set some values in my code depending on whether the platform
> is in debug mode or not. To describe the background: My application
> works with timeouts and it'd be cute to automatically let them never
> expire while debugging the application.
>
> I tried to call Platform.inDebugMode(), but it always returned false.
> Then I tried to query the EnvironmentService with the same result.
> The system properties never contain "osgi.debug=true" or "-debug".
>
> Have I missed something?
>
> Cheers
> /Eike
|
|
|
| Re: Determine debug mode [message #72658 is a reply to message #72543] |
Mon, 28 August 2006 17:16  |
Thomas Watson Messages: 390 Registered: July 2009 |
Senior Member |
|
|
The osgi.debug property only gets set if you are using the -debug option
to launch eclipse. The -debug option can be uses regardless of whether
you have a Java debugger attached or not. The purpose of the -debug
option is to point the system to a debug options file where you can set
debug options for individual bundles running in the framework.
Debug is an overused term here. If you launch an Eclipse instance from
a workspace using the Eclipse Application launcher you will see a
"Tracing" tab. You can use this to set various "tracing" options.
Looking back it may have been better to call this option -trace instead
of -debug.
You could use the -debug option to set different timeouts in your code.
To do this you would add a .options file to the root of your bundle
that would contain some default values. For example the
org.eclipse.osgi bundle contains the following .options file entries (I
did not include the complete file for simplicity)
# Turn on general debugging for org.eclipse.osgi
org.eclipse.osgi/debug=false
# Override the default implemenation
org.eclipse.osgi/profile/impl=org.eclipse.osgi.internal.prof ile.DefaultProfileLogger
# Specify the size of the default profile implementation log buffer.
org.eclipse.osgi/defaultprofile/buffersize = 256
The values of the debug options can be String, Integer or Boolean. In
you .options you would have the defaults timeouts. Then you can change
the timeout options used for debugging. You use Platform.getDebugOption
or the DebugOptions OSGi service to get the debug option you want.
HTH.
Tom
Eike Stepper wrote:
> Currently I work around with the following:
>
> public static final boolean DEBUG_MODE =
> !System.getProperty("java.vm.info", "").contains("sharing");
>
> But I'm not sure if the result will be correct in all circumstances.
> Platform.inDebugMode() would be nicer.
>
> Cheers
> /Eike
|
|
|
Powered by
FUDForum. Page generated in 0.07441 seconds