Package edu.uiuc.ncsa.security.core.util
Class DebugUtil
- java.lang.Object
- 
- edu.uiuc.ncsa.security.core.util.DebugUtil
 
- 
- All Implemented Interfaces:
- DebugConstants
 - Direct Known Subclasses:
- ServletDebugUtil
 
 public class DebugUtil extends Object implements DebugConstants Utilities for centralizing some common debugging commands. The debug level is set globally for all calls to this. Note that this is not logging. Use theMyLoggingFacadefor that. This is for levels of debugging that may be turned off completely. Logging will be put into the log file. Debugging commands all go to stderr so that they are not part of logging on purpose, but can be collected and viewed separately.Optionally if this is being run on a server, you may specify a host to be printed with each message. If this is not set, that is fine. Created by Jeff Gaynor 
 on 7/27/16 at 2:55 PM
- 
- 
Field SummaryFields Modifier and Type Field Description static StringDEFAULT_CONFIG_ROOTstatic StringDEFAULT_DEV_OUTPUTstatic StringDEFAULT_DEV_ROOTstatic StringNCSA_CONFIG_ROOTstatic StringNCSA_DEV_INPUTstatic StringNCSA_DEV_OUTPUT- 
Fields inherited from interface edu.uiuc.ncsa.security.core.util.DebugConstantsDEBUG_LEVEL_ERROR, DEBUG_LEVEL_ERROR_LABEL, DEBUG_LEVEL_INFO, DEBUG_LEVEL_INFO_LABEL, DEBUG_LEVEL_OFF, DEBUG_LEVEL_OFF_LABEL, DEBUG_LEVEL_SEVERE, DEBUG_LEVEL_SEVERE_LABEL, DEBUG_LEVEL_TRACE, DEBUG_LEVEL_TRACE_LABEL, DEBUG_LEVEL_UNKNOWN, DEBUG_LEVEL_WARN, DEBUG_LEVEL_WARN_LABEL
 
- 
 - 
Constructor SummaryConstructors Constructor Description DebugUtil()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voiddbg(Class callingClass, String message)Deprecated.use warn insteadstatic voiddbg(Class callingClass, String message, Throwable throwable)Deprecated.use error insteadstatic voiddbg(Object callingObject, String message)Deprecated.use warn insteadstatic voiddbg(Object callingObject, String message, Throwable throwable)Deprecated.use error insteadstatic voiderror(Class callingClass, String message)static voiderror(Class callingClass, String message, Throwable t)static voiderror(Object obj, String message)static voiderror(Object obj, String message, Throwable t)static voiderror(String title, String message, Throwable t)static voiderror(String message, Throwable t)static StringgetConfigPath()static intgetDebugLevel()static StringgetDevOutput()static StringgetDevPath()This is used to supply all the paths in tests.static MetaDebugUtilgetInstance()static booleanhasInstance()If an instance has been set.static voidinfo(Class callingClass, String message)static voidinfo(Object obj, String message)static voidinfo(String message)static voidinfo(String title, String message)static booleanisEnabled()static booleanisPrintTS()static booleanisTraceEnabled()static voidprintIt(int level, Class callingClass, String message)static voidprintIt(int level, Class callingClass, String message, Throwable throwable)This only prints if the requested level is at least error AND the current utility supports it.protected static voidprintIt(String message)static voidprintStackTrace(Throwable t)static voidsetDebugLevel(int newDebugLevel)static voidsetDebugLevel(String label)This is used to set the debugging level from a label.static voidsetEnabled(boolean enabled)static voidsetHost(String host)static voidsetInstance(MetaDebugUtil newDebugUtil)static voidsetIsEnabled(boolean isEnabled)static voidsetPrintTS(boolean printTS)static voidsevere(Class callingClass, String message)static voidsevere(Class callingClass, String message, Throwable t)static voidsevere(Object obj, String message)static voidsevere(Object obj, String message, Throwable t)static voidsevere(String title, String message, Throwable t)static voidsevere(String message, Throwable t)protected static StringtoLabel(int level)protected static inttoLevel(String label)static voidtrace(boolean doLocal, Class callingClass, String message)static voidtrace(boolean doLocal, Class callingClass, String message, Throwable t)static voidtrace(boolean doLocal, Object obj, String message)static voidtrace(boolean doLocal, Object obj, String message, Throwable t)static voidtrace(Class callingClass, String message)static voidtrace(Class callingClass, String message, Throwable t)static voidtrace(Object obj, String message)static voidtrace(Object obj, String message, Throwable t)static voidtrace(String message)static voidtrace(String title, String message, Throwable t)static voidtrace(String message, Throwable t)static voidwarn(Class callingClass, String message)static voidwarn(Object obj, String message)static voidwarn(String message)static voidwarn(String title, String message)
 
- 
- 
- 
Field Detail- 
NCSA_DEV_INPUTpublic static String NCSA_DEV_INPUT 
 - 
DEFAULT_DEV_ROOTpublic static String DEFAULT_DEV_ROOT 
 - 
NCSA_CONFIG_ROOTpublic static String NCSA_CONFIG_ROOT 
 - 
DEFAULT_CONFIG_ROOTpublic static String DEFAULT_CONFIG_ROOT 
 - 
NCSA_DEV_OUTPUTpublic static String NCSA_DEV_OUTPUT 
 - 
DEFAULT_DEV_OUTPUTpublic static String DEFAULT_DEV_OUTPUT 
 
- 
 - 
Method Detail- 
getInstancepublic static MetaDebugUtil getInstance() 
 - 
setInstancepublic static void setInstance(MetaDebugUtil newDebugUtil) 
 - 
hasInstancepublic static boolean hasInstance() If an instance has been set. Note that callinggetInstance()will always return an instance.- Returns:
 
 - 
setEnabledpublic static void setEnabled(boolean enabled) 
 - 
isPrintTSpublic static boolean isPrintTS() 
 - 
setPrintTSpublic static void setPrintTS(boolean printTS) 
 - 
toLabelprotected static String toLabel(int level) 
 - 
setDebugLevelpublic static void setDebugLevel(String label) This is used to set the debugging level from a label.- Parameters:
- label-
 
 - 
toLevelprotected static int toLevel(String label) 
 - 
getDebugLevelpublic static int getDebugLevel() 
 - 
setDebugLevelpublic static void setDebugLevel(int newDebugLevel) 
 - 
isEnabledpublic static boolean isEnabled() 
 - 
isTraceEnabledpublic static boolean isTraceEnabled() 
 - 
printStackTracepublic static void printStackTrace(Throwable t) 
 - 
setIsEnabledpublic static void setIsEnabled(boolean isEnabled) 
 - 
printItprotected static void printIt(String message) 
 - 
printItpublic static void printIt(int level, Class callingClass, String message, Throwable throwable)This only prints if the requested level is at least error AND the current utility supports it. Note that if there is no exception, then that is noted in the log as well.- Parameters:
- level-
- callingClass-
- message-
- throwable-
 
 - 
infopublic static void info(String message) 
 - 
warnpublic static void warn(String message) 
 - 
tracepublic static void trace(String message) 
 - 
dbgpublic static void dbg(Object callingObject, String message) Deprecated.use warn insteadThis will print out a message from a class that includes the class name and current timestamp.- Parameters:
- callingObject-
- message-
 
 - 
dbgpublic static void dbg(Object callingObject, String message, Throwable throwable) Deprecated.use error instead- Parameters:
- callingObject-
- message-
- throwable-
 
 - 
dbgpublic static void dbg(Class callingClass, String message, Throwable throwable) Deprecated.use error instead- Parameters:
- callingClass-
- message-
- throwable-
 
 - 
dbgpublic static void dbg(Class callingClass, String message) Deprecated.use warn instead- Parameters:
- callingClass-
- message-
 
 - 
setHostpublic static void setHost(String host) 
 - 
getDevPathpublic static String getDevPath() This is used to supply all the paths in tests. Set the environment variable NCSA_DEV_PATH and it will be used to resolve resources etc.- Returns:
 
 - 
getConfigPathpublic static String getConfigPath() 
 - 
getDevOutputpublic static String getDevOutput() 
 
- 
 
-