public class LogWrapper extends Object
Modifier and Type | Field and Description |
---|---|
private static OutputStream |
backup
OutputStream to log to if log4j is not available.
|
private static boolean |
DEBUG
Should we print DEBUG statements if log4j is not available?
|
(package private) static DateFormat |
DF |
private LogHelper |
h |
(package private) static String[] |
LEVELS |
(package private) static String |
LINE_SEPARATOR |
static boolean |
log4j
true if log4j is available
|
private static LogWrapper |
NOOP |
(package private) static int |
TIMESTAMP_LENGTH |
(package private) static String |
TIMESTAMP_PATTERN |
private static PrintStream |
wrappingPrintStream
The wrappingPrintStream is lazy-initted if we have to log a stacktrace.
|
Modifier | Constructor and Description |
---|---|
private |
LogWrapper() |
private |
LogWrapper(Class c) |
private |
LogWrapper(String s) |
Modifier and Type | Method and Description |
---|---|
void |
debug(Object o) |
void |
debug(Object o,
Throwable t) |
void |
error(Object o) |
void |
error(Object o,
Throwable t) |
void |
fatal(Object o) |
void |
fatal(Object o,
Throwable t) |
static OutputStream |
getBackupStream()
Get the PrintStream we're logging to if log4j is not available.
|
Object |
getLog4jLogger() |
static LogWrapper |
getLogger(Class c) |
static LogWrapper |
getLogger(String s) |
void |
info(Object o) |
void |
info(Object o,
Throwable t) |
boolean |
isDebugEnabled() |
boolean |
isInfoEnabled() |
static boolean |
isLog4jAvailable() |
static void |
setBackupLogFile(String f)
Set file to log to if log4j is not available.
|
static void |
setBackupStream(OutputStream os)
Set PrintStream to log to if log4j is not available.
|
private boolean |
t(int level,
Object o,
Throwable t)
Tests if log4j is available.
|
void |
warn(Object o) |
void |
warn(Object o,
Throwable t) |
static final String TIMESTAMP_PATTERN
static final int TIMESTAMP_LENGTH
static final String LINE_SEPARATOR
static final DateFormat DF
private static final LogWrapper NOOP
private static final boolean DEBUG
public static final boolean log4j
private static volatile OutputStream backup
private static volatile PrintStream wrappingPrintStream
private LogWrapper()
private LogWrapper(Class c)
private LogWrapper(String s)
public static boolean isLog4jAvailable()
public static LogWrapper getLogger(Class c)
public static LogWrapper getLogger(String s)
public boolean isDebugEnabled()
public boolean isInfoEnabled()
public Object getLog4jLogger()
private boolean t(int level, Object o, Throwable t)
level
- log4j logging level for this statemento
- object to logt
- throwable to logpublic static void setBackupLogFile(String f) throws IOException
f
- path to use for backup log file (if log4j not available)IOException
- if we can't write to the given pathpublic static void setBackupStream(OutputStream os)
os
- outputstream to use for backup logging (if log4j not available)public static OutputStream getBackupStream()