public class DebugUtil extends Object
MyLoggingFacade
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
Modifier and Type | Field and Description |
---|---|
static int |
DEBUG_LEVEL_ERROR
Show errors or possible branch points of errors, but ones that still allow the control flow to continue
|
static String |
DEBUG_LEVEL_ERROR_LABEL |
static int |
DEBUG_LEVEL_INFO
ONly basic information should be displayed, such as milestones in the control flow
|
static String |
DEBUG_LEVEL_INFO_LABEL |
static int |
DEBUG_LEVEL_OFF
Turn of debugging
|
static String |
DEBUG_LEVEL_OFF_LABEL |
static int |
DEBUG_LEVEL_SEVERE
Show error that stop the control flow that probably lead the application to abort of be unrecoverable.
|
static String |
DEBUG_LEVEL_SEVERE_LABEL |
static int |
DEBUG_LEVEL_TRACE
Show detailed information about the execution so that detailed information about the control flow
can be seen.
|
static String |
DEBUG_LEVEL_TRACE_LABEL |
static int |
DEBUG_LEVEL_WARN
Display warnings about the control flow and possibly harmful things
|
static String |
DEBUG_LEVEL_WARN_LABEL |
protected static int |
debugLevel |
static String |
host |
Constructor and Description |
---|
DebugUtil() |
Modifier and Type | Method and Description |
---|---|
protected 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.
|
static void |
dbg(Class callingClass,
String message)
Deprecated.
use warn instead
|
static void |
dbg(Class callingClass,
String message,
Throwable throwable)
Deprecated.
use error instead
|
static void |
dbg(Object callingObject,
String message)
Deprecated.
use warn instead
|
static void |
dbg(Object callingObject,
String message,
Throwable throwable)
Deprecated.
use error instead
|
static 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 int |
getDebugLevel() |
static void |
info(Class callingClass,
String message) |
static void |
info(Object obj,
String message) |
static boolean |
isEnabled() |
static void |
printIt(int level,
Class callingClass,
String message)
The actual call for this entire class.
|
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 |
setDebugLevel(int newDebugLevel) |
static void |
setDebugLevel(String label)
This is used to set the debugging level from a label.
|
static void |
setIsEnabled(boolean isEnabled) |
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) |
protected static String |
toLabel(int level) |
protected static int |
toLevel(String label) |
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 |
warn(Class callingClass,
String message) |
static void |
warn(Object obj,
String message) |
public static int DEBUG_LEVEL_OFF
public static int DEBUG_LEVEL_INFO
public static int DEBUG_LEVEL_WARN
public static int DEBUG_LEVEL_ERROR
public static int DEBUG_LEVEL_SEVERE
public static int DEBUG_LEVEL_TRACE
public static String DEBUG_LEVEL_OFF_LABEL
public static String DEBUG_LEVEL_INFO_LABEL
public static String DEBUG_LEVEL_WARN_LABEL
public static String DEBUG_LEVEL_ERROR_LABEL
public static String DEBUG_LEVEL_SEVERE_LABEL
public static String DEBUG_LEVEL_TRACE_LABEL
protected static int debugLevel
public static String host
protected static String toLabel(int level)
protected static boolean checkLevelAndLabel(String targetLabel, String givenLabel)
targetLabel
- givenLabel
- public static void setDebugLevel(String label)
label
- protected static int toLevel(String label)
public static int getDebugLevel()
public static void setDebugLevel(int newDebugLevel)
public static boolean isEnabled()
public static void setIsEnabled(boolean isEnabled)
public static void printIt(int level, Class callingClass, String message)
level
- callingClass
- message
- protected static void printIt(String message)
public static void printIt(int level, Class callingClass, String message, Throwable throwable)
level
- callingClass
- message
- throwable
- public static void dbg(Object callingObject, String message)
callingObject
- message
- public static void dbg(Object callingObject, String message, Throwable throwable)
callingObject
- message
- throwable
- public static void dbg(Class callingClass, String message, Throwable throwable)
callingClass
- message
- throwable
- Copyright © 2019. All Rights Reserved.