public abstract class Logger extends Object implements Closeable, Flushable
This base class is MT-safe with respect to its public methods, and MT-safe concrete classes would need to synchronise access to
their log(CharSequence msg) and flush() methods.
This class makes some inexpensive provision for multi-threading, but the overridden log() and flush() methods need to be synchronized
to make it fully MT-safe.
Modifier and Type | Class and Description |
---|---|
static class |
Logger.LEVEL |
Modifier and Type | Field and Description |
---|---|
protected int |
bufsiz |
static String |
SYSPROP_DIAG |
Modifier | Constructor and Description |
---|---|
protected |
Logger(Parameters params,
String logname,
boolean is_mt) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
closeStream(boolean is_owner) |
void |
error(CharSequence msg) |
void |
flush() |
String |
getActivePath() |
Logger.LEVEL |
getLevel() |
String |
getName() |
String |
getPathTemplate() |
void |
info(CharSequence msg) |
protected void |
init() |
boolean |
isActive(Logger.LEVEL lvl) |
abstract void |
log(Logger.LEVEL lvl,
CharSequence msg) |
void |
log(Logger.LEVEL lvl,
Throwable ex,
boolean dumpStack,
CharSequence msg) |
protected void |
openStream(OutputStream strm) |
protected void |
openStream(String pthnam) |
Logger.LEVEL |
setLevel(Logger.LEVEL newlvl) |
protected StringBuilder |
setLogEntry(Logger.LEVEL lvl,
StringBuilder pfxbuf) |
String |
toString() |
void |
trace(CharSequence msg) |
void |
warn(CharSequence msg) |
public static final String SYSPROP_DIAG
protected final int bufsiz
protected Logger(Parameters params, String logname, boolean is_mt)
public abstract void log(Logger.LEVEL lvl, CharSequence msg)
protected void openStream(OutputStream strm) throws IOException
IOException
protected void openStream(String pthnam) throws IOException
IOException
protected void closeStream(boolean is_owner) throws IOException
IOException
public void flush() throws IOException
flush
in interface Flushable
IOException
public boolean isActive(Logger.LEVEL lvl)
public String getName()
public String getPathTemplate()
public String getActivePath()
protected void init() throws IOException
IOException
public Logger.LEVEL getLevel()
public Logger.LEVEL setLevel(Logger.LEVEL newlvl)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public void log(Logger.LEVEL lvl, Throwable ex, boolean dumpStack, CharSequence msg)
protected StringBuilder setLogEntry(Logger.LEVEL lvl, StringBuilder pfxbuf) throws IOException
IOException
public void error(CharSequence msg)
public void warn(CharSequence msg)
public void info(CharSequence msg)
public void trace(CharSequence msg)
Copyright 2010-2018 Grey Software (Yusef Badri). All Rights Reserved.