|
Java EE 5 SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.appserv.management.base.AMXDebug
public final class AMXDebug
Internal debug facility. For development use only. Do not use this class; it is subject to arbitrary change.
AMX has some unique issues that make a separate debug facility highly useful. These include:
Usage notes
AMXDebug associates a file with each identifier (typically a classname).
These files are located within the AMX_DEBUG_SUBDIR
subdirectory within the directory specified by
System.getProperty( "user.home" ) unless the system property
AMX_DEBUG_DIR_SPROP
is specified.
All resulting AMXDebug output files
end in the suffix AMX_DEBUG_SUFFIX
.
This fine-grained approach makes it possible to "tail" just the output from just the classes of interest, something that is difficult or impossible otherwise.
AMXDebug is designed as a singleton. However, arbitrary identifiers may be used to associate debugging output with a particular output file. This allows fine-grained and selective debugging of just the items of interest.
When debugging is off, overhead is minimal, because all debugging calls are routed to "dev/null". The caller can also wrap such calls such that they don't make it to AMXDebug at all.
The debug flag may be set via the system property
AMX_DEBUG_ENABLED_SPROP
. Debugging will be enabled if that
property has value "true". Otherwise, it is disabled.
Debugging may also be programmatically enabled, on a per-ID
basis.
The expected usage is per-class and the classname can generally be used as the identifier. However, usage include other patterns; anything that the emitting code can agree on, regardless of whether it is in the same class, or spread across many. One possibility would be to place the Output into the thread context. There are other possibilities.
Output may be marked using the mark(com.sun.appserv.management.util.misc.Output, java.lang.String)
and markAll(java.lang.String)
routines.
This aids in visually organizing the output.
For more information, see the javadoc on individual routines.
Nested Class Summary | |
---|---|
class |
AMXDebug.WrapOutput
Internal class which wraps the Output so that debug may be dynamically enabled or disable without any users of the Output having to be aware of it. |
Field Summary | |
---|---|
static String |
AMX_DEBUG_APPEND_SPROP
the key for the system property to append to debug files. |
static String |
AMX_DEBUG_DIR_SPROP
The key for the system property to specify a different AMX_DEBUG_DIR. |
static String |
AMX_DEBUG_ENABLED_SPROP
the key for the system property to enable AMX debug facility |
static String |
AMX_DEBUG_SUBDIR
The name of the default subdirectory which contains the ".debug" files created by AMXDebug. |
static String |
AMX_DEBUG_SUFFIX
Suffix used on all Output files. |
Method Summary | |
---|---|
void |
cleanup()
Turn off all debugging and close all files. |
boolean |
getDebug(String id)
Get the debug state of a particular Output for the specified ID. |
boolean |
getDefaultDebug()
Get the current default debug state used when any new Outputs are created. |
static AMXDebug |
getInstance()
Get the Singletone AMXDebug instance. |
Output |
getOutput(String id)
ID is typically a classname, but may be anything which can be used for a filename. |
File |
getOutputFile(String id)
Get the File associated with 'id'. |
String[] |
getOutputIDs()
|
Output |
getShared()
|
String |
getStdMarker()
The standard marker line emitted by mark(com.sun.appserv.management.util.misc.Output, java.lang.String) . |
String |
getStdMarker(String msg)
The standard marker line emitted by mark(com.sun.appserv.management.util.misc.Output, java.lang.String) with a message
inserted. |
void |
mark(Output output,
String marker)
Output a marker into the Output. |
void |
mark(String id)
Output a standard marker into the Output. |
void |
mark(String id,
String marker)
Output a marker into the Output associated with 'id'. |
void |
markAll()
Output a standard marker into the Output. |
void |
markAll(String marker)
Output a standard marker into the Output. |
static String |
methodString(String name,
Object... args)
|
void |
reset(String id)
Turn off debugging any close the associated file (if any) for the Output specified by 'id'. |
void |
setAll(boolean debug)
Set the debug state of all Outputs. |
void |
setDebug(String id,
boolean debug)
Set the debug state of a particular Output for the specified ID. |
void |
setDefaultDebug(boolean debug)
Set the current default debug state. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String AMX_DEBUG_ENABLED_SPROP
public static final String AMX_DEBUG_APPEND_SPROP
public static final String AMX_DEBUG_DIR_SPROP
AMX_DEBUG_SUBDIR
) is used directly.
If the sytem property
AMX_DEBUG_SUBDIR
is not specified,
then AMXDebug looks for the system property
"com.sun.aas.instanceRoot". If that system property
is not found, then "user.home" is used. The result of this is
the "parent dir". The resulting output
directory is then AMX_DEBUG_SUBDIR
.
public static final String AMX_DEBUG_SUBDIR
AMX_DEBUG_DIR_SPROP
is not specified.
public static final String AMX_DEBUG_SUFFIX
Method Detail |
---|
public String[] getOutputIDs()
public boolean getDefaultDebug()
public void setDefaultDebug(boolean debug)
setAll(boolean)
public boolean getDebug(String id)
public void setDebug(String id, boolean debug)
public void setAll(boolean debug)
setDebug(java.lang.String, boolean)
public void cleanup()
public void reset(String id)
public String getStdMarker()
mark(com.sun.appserv.management.util.misc.Output, java.lang.String)
.
public String getStdMarker(String msg)
mark(com.sun.appserv.management.util.misc.Output, java.lang.String)
with a message
inserted.
public void mark(Output output, String marker)
public void mark(String id, String marker)
public void mark(String id)
public void markAll(String marker)
public void markAll()
public static AMXDebug getInstance()
public File getOutputFile(String id)
public Output getShared()
public Output getOutput(String id)
AMX_DEBUG_SUBDIR
directory.
public static String methodString(String name, Object... args)
|
Java EE 5 SDK | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2006 Sun Microsystems, Inc. All rights reserved.