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 theMyLoggingFacade
for 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 String
DEFAULT_CONFIG_ROOT
static String
DEFAULT_DEV_OUTPUT
static String
DEFAULT_DEV_ROOT
static String
NCSA_CONFIG_ROOT
static String
NCSA_DEV_INPUT
static String
NCSA_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 void
dbg(Class callingClass, String message)
Deprecated.use warn insteadstatic void
dbg(Class callingClass, String message, Throwable throwable)
Deprecated.use error insteadstatic void
dbg(Object callingObject, String message)
Deprecated.use warn insteadstatic void
dbg(Object callingObject, String message, Throwable throwable)
Deprecated.use error insteadstatic void
error(Class callingClass, String message)
static void
error(Class callingClass, String message, Throwable t)
static void
error(Object obj, String message)
static void
error(Object obj, String message, Throwable t)
static void
error(String title, String message, Throwable t)
static void
error(String message, Throwable t)
static String
getConfigPath()
static int
getDebugLevel()
static String
getDevOutput()
static String
getDevPath()
This is used to supply all the paths in tests.static MetaDebugUtil
getInstance()
static boolean
hasInstance()
If an instance has been set.static void
info(Class callingClass, String message)
static void
info(Object obj, String message)
static void
info(String message)
static void
info(String title, String message)
static boolean
isEnabled()
static boolean
isPrintTS()
static void
printIt(int level, Class callingClass, String message)
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.protected static void
printIt(String message)
static void
printStackTrace(Throwable t)
static void
setDebugLevel(int newDebugLevel)
static void
setDebugLevel(String label)
This is used to set the debugging level from a label.static void
setEnabled(boolean enabled)
static void
setHost(String host)
static void
setInstance(MetaDebugUtil newDebugUtil)
static void
setIsEnabled(boolean isEnabled)
static void
setPrintTS(boolean printTS)
static void
severe(Class callingClass, String message)
static void
severe(Class callingClass, String message, Throwable t)
static void
severe(Object obj, String message)
static void
severe(Object obj, String message, Throwable t)
static void
severe(String title, String message, Throwable t)
static void
severe(String message, Throwable t)
protected static String
toLabel(int level)
protected static int
toLevel(String label)
static void
trace(boolean doLocal, Class callingClass, String message)
static void
trace(boolean doLocal, Class callingClass, String message, Throwable t)
static void
trace(boolean doLocal, Object obj, String message)
static void
trace(boolean doLocal, Object obj, String message, Throwable t)
static void
trace(Class callingClass, String message)
static void
trace(Class callingClass, String message, Throwable t)
static void
trace(Object obj, String message)
static void
trace(Object obj, String message, Throwable t)
static void
trace(String message)
static void
trace(String title, String message, Throwable t)
static void
trace(String message, Throwable t)
static void
warn(Class callingClass, String message)
static void
warn(Object obj, String message)
static void
warn(String message)
static void
warn(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()
-
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()
-
-