Class MetaDebugUtil
- java.lang.Object
- 
- edu.uiuc.ncsa.security.core.util.MetaDebugUtil
 
- 
- All Implemented Interfaces:
- DebugConstants,- Serializable
 
 public class MetaDebugUtil extends Object implements DebugConstants, Serializable Very useful debugging class. This is much like logging with various levels of debugging available, but this prints to std err, not std out. The idea is that you can stick debug notices everywhere and turn it off and on as needed. Giving a second debug-only system that is not loggged. In many cases you do not want debug information going to a log (such as if the log might be public and there is sensitive information). This lets you stick view it separately. What other advantage to a debug system? In many cases code is running in some service that has logging, say, piped to the system log. (Common approach for Tomcat running under Apache). This means that the log might be simply enormous and processing it looking for your 3 debug statements is hard or very slow. (Think active production server with literally hundreds of entries being generated every second.) These debug statements get sent to standard error, so it is easy to turn it on for a bit, pick them up, then turn debugging back off. Created by Jeff Gaynor 
 on 10/23/20 at 2:54 PM- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected intdebugLevelstatic StringDEFAULT_TITLEStringhoststatic StringJSON_DELIMITERstatic StringJSON_ENABLEDstatic StringJSON_HOSTstatic StringJSON_LEVELstatic StringJSON_TITLEstatic StringJSON_TS_ON- 
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 MetaDebugUtil()MetaDebugUtil(String title, int debugLevel, boolean printTS)MetaDebugUtil(String title, int debugLevel, boolean printTS, String host)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static booleancheckLevelAndLabel(String targetLabel, String givenLabel)Do a case-insensitive check for equality of a given label and one of the pre-defined (target) labels.voiderror(Class callingClass, String message)voiderror(Class callingClass, String message, Throwable t)voiderror(Object obj, String message)voiderror(Object obj, String message, Throwable t)voiderror(String message)voiderror(String title, String message)voiderror(String title, String message, Throwable t)voiderror(String message, Throwable t)voidfromJSON(net.sf.json.JSONObject json)intgetDebugLevel()StringgetDelimiter()StringgetHost()StringgetTitle()Name of the component that goes in the entry.booleanhasHost()voidinfo(Class callingClass, String message)voidinfo(Object obj, String message)voidinfo(String message)voidinfo(String title, String message)booleanisEnabled()Checks if the debug level is set to off.booleanisPrintTS()voidprintIt(int level, Class callingClass, String message)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.voidprintIt(int level, String title, String message)voidprintIt(int level, String title, String message, Throwable throwable)protected voidprintIt(String message)voidsetDebugLevel(int newDebugLevel)voidsetDebugLevel(String label)This is used to set the debugging level from a label.voidsetDelimiter(String delimiter)voidsetHost(String host)voidsetIsEnabled(boolean isEnabled)Deprecated.voidsetPrintTS(boolean printTS)voidsetTitle(String title)voidsevere(Class callingClass, String message)voidsevere(Class callingClass, String message, Throwable t)voidsevere(Object obj, String message)voidsevere(Object obj, String message, Throwable t)voidsevere(String message)voidsevere(String title, String message)voidsevere(String title, String message, Throwable t)voidsevere(String message, Throwable t)net.sf.json.JSONObjecttoJSON()static StringtoLabel(int level)static inttoLevel(String label)StringtoString()voidtrace(Class callingClass, String message)voidtrace(Class callingClass, String message, Throwable t)voidtrace(Object obj, String message)voidtrace(Object obj, String message, Throwable t)voidtrace(String message)voidtrace(String title, String message)voidtrace(String title, String message, Throwable t)voidtrace(String message, Throwable t)voidwarn(Class callingClass, String message)voidwarn(Object obj, String message)voidwarn(String message)voidwarn(String title, String message)
 
- 
- 
- 
Field Detail- 
DEFAULT_TITLEpublic static String DEFAULT_TITLE 
 - 
debugLevelprotected int debugLevel 
 - 
hostpublic String host 
 - 
JSON_LEVELpublic static final String JSON_LEVEL - See Also:
- Constant Field Values
 
 - 
JSON_DELIMITERpublic static final String JSON_DELIMITER - See Also:
- Constant Field Values
 
 - 
JSON_TS_ONpublic static final String JSON_TS_ON - See Also:
- Constant Field Values
 
 - 
JSON_TITLEpublic static final String JSON_TITLE - See Also:
- Constant Field Values
 
 - 
JSON_ENABLEDpublic static final String JSON_ENABLED - See Also:
- Constant Field Values
 
 - 
JSON_HOSTpublic static final String JSON_HOST - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
isPrintTSpublic boolean isPrintTS() 
 - 
setPrintTSpublic void setPrintTS(boolean printTS) 
 - 
getTitlepublic String getTitle() Name of the component that goes in the entry. This may be set and used implcitly or you may explicitly call with the name of the object.- Returns:
 
 - 
setTitlepublic void setTitle(String title) 
 - 
toLabelpublic static String toLabel(int level) 
 - 
checkLevelAndLabelprotected static boolean checkLevelAndLabel(String targetLabel, String givenLabel) Do a case-insensitive check for equality of a given label and one of the pre-defined (target) labels.- Parameters:
- targetLabel-
- givenLabel-
- Returns:
 
 - 
setDebugLevelpublic void setDebugLevel(String label) This is used to set the debugging level from a label.- Parameters:
- label-
 
 - 
toLevelpublic static int toLevel(String label) 
 - 
getDebugLevelpublic int getDebugLevel() 
 - 
setDebugLevelpublic void setDebugLevel(int newDebugLevel) 
 - 
isEnabledpublic boolean isEnabled() Checks if the debug level is set to off.- Returns:
 
 - 
setIsEnabledpublic void setIsEnabled(boolean isEnabled) Deprecated.Setting this to true will set the debug level to warn only. It is better to use thesetDebugLevel(int)directly. Some very old applications still use this.- Parameters:
- isEnabled-
 
 - 
getDelimiterpublic String getDelimiter() 
 - 
setDelimiterpublic void setDelimiter(String delimiter) 
 - 
printItprotected void printIt(String message) 
 - 
printItpublic 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 void info(String message) 
 - 
warnpublic void warn(String message) 
 - 
errorpublic void error(String message) 
 - 
severepublic void severe(String message) 
 - 
tracepublic void trace(String message) 
 - 
hasHostpublic boolean hasHost() 
 - 
getHostpublic String getHost() 
 - 
setHostpublic void setHost(String host) 
 - 
toJSONpublic net.sf.json.JSONObject toJSON() 
 - 
fromJSONpublic void fromJSON(net.sf.json.JSONObject json) 
 
- 
 
-