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 Summary
Fields 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.DebugConstants
DEBUG_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 Summary
Constructors Constructor Description DebugUtil()
-
Method Summary
All 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_INPUT
public static String NCSA_DEV_INPUT
-
DEFAULT_DEV_ROOT
public static String DEFAULT_DEV_ROOT
-
NCSA_CONFIG_ROOT
public static String NCSA_CONFIG_ROOT
-
DEFAULT_CONFIG_ROOT
public static String DEFAULT_CONFIG_ROOT
-
NCSA_DEV_OUTPUT
public static String NCSA_DEV_OUTPUT
-
DEFAULT_DEV_OUTPUT
public static String DEFAULT_DEV_OUTPUT
-
-
Method Detail
-
getInstance
public static MetaDebugUtil getInstance()
-
setInstance
public static void setInstance(MetaDebugUtil newDebugUtil)
-
hasInstance
public static boolean hasInstance()
If an instance has been set. Note that callinggetInstance()will always return an instance.- Returns:
-
setEnabled
public static void setEnabled(boolean enabled)
-
isPrintTS
public static boolean isPrintTS()
-
setPrintTS
public static void setPrintTS(boolean printTS)
-
toLabel
protected static String toLabel(int level)
-
setDebugLevel
public static void setDebugLevel(String label)
This is used to set the debugging level from a label.- Parameters:
label-
-
toLevel
protected static int toLevel(String label)
-
getDebugLevel
public static int getDebugLevel()
-
setDebugLevel
public static void setDebugLevel(int newDebugLevel)
-
isEnabled
public static boolean isEnabled()
-
isTraceEnabled
public static boolean isTraceEnabled()
-
printStackTrace
public static void printStackTrace(Throwable t)
-
setIsEnabled
public static void setIsEnabled(boolean isEnabled)
-
printIt
protected static void printIt(String message)
-
printIt
public 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-
-
info
public static void info(String message)
-
warn
public static void warn(String message)
-
trace
public static void trace(String message)
-
dbg
public 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-
-
dbg
public static void dbg(Object callingObject, String message, Throwable throwable)
Deprecated.use error instead- Parameters:
callingObject-message-throwable-
-
dbg
public static void dbg(Class callingClass, String message, Throwable throwable)
Deprecated.use error instead- Parameters:
callingClass-message-throwable-
-
dbg
public static void dbg(Class callingClass, String message)
Deprecated.use warn instead- Parameters:
callingClass-message-
-
setHost
public static void setHost(String host)
-
getDevPath
public 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:
-
getConfigPath
public static String getConfigPath()
-
getDevOutput
public static String getDevOutput()
-
-