public class Logger extends PrintStream
CustomLog mylogr = new CustomLog();
Properties props = System.getProperties();
props.put("io.starter.toolkit.logger", mylogr );
props.put("io.starter.toolkit.logger.dateformat", "MMM yyyy mm:ss" );
props.put("io.starter.toolkit.logger.dateformat", "none" );
| Modifier and Type | Field and Description |
|---|---|
static String |
DATE_FORMAT
The default time stamp format for
getLogDate(). |
static String |
ERROR_STRING |
static String |
INFO_STRING |
protected PrintStream |
ous
Deprecated.
Just use
this. |
static String |
WARN_STRING |
out| Constructor and Description |
|---|
Logger(Logger target) |
Logger(Logger target,
String charset) |
Logger(OutputStream target) |
Logger(OutputStream target,
boolean autoFlush) |
Logger(OutputStream target,
String charset,
boolean autoFlush) |
Logger(Writer target) |
Logger(Writer target,
boolean autoFlush) |
Logger(Writer target,
String charset,
boolean autoFlush) |
| Modifier and Type | Method and Description |
|---|---|
Logger |
append(char value) |
Logger |
append(CharSequence value) |
Logger |
append(CharSequence value,
int start,
int end) |
static String |
formatThrowable(String message,
Throwable ex,
boolean trace) |
static String |
getLogDate()
Returns the current time in a configurable format.
|
static Logger |
getLogger()
Gets the current system logger.
|
void |
install()
Installs this logger as the default logger and replaces the standard
output and error streams.
|
static void |
log(Object object)
Logs the string conversion of an object to the system logger.
|
static void |
log(String message) |
void |
log(String message,
Exception ex) |
void |
log(String message,
Exception ex,
boolean trace) |
static void |
logErr(Exception ex)
Logs the string conversion of an exception to the system logger as a
fatal error message.
|
static void |
logErr(String message)
Logs a fatal error message to the system logger.
|
static void |
logErr(String message,
Exception ex)
Logs a fatal error message to the system logger.
|
static void |
logErr(String message,
Exception ex,
boolean trace)
Logs a fatal error message to the system logger.
|
static void |
logErr(String message,
Throwable ex)
Logs a fatal error message to the system logger.
|
static void |
logInfo(String message)
Logs an informational message to the system logger.
|
void |
logLine() |
static void |
logWarn(String message)
Logs a non-fatal warning to the system logger.
|
void |
print(boolean b) |
void |
print(char c) |
void |
print(char[] s) |
void |
print(double d) |
void |
print(float f) |
void |
print(int i) |
void |
print(long l) |
void |
print(Object obj) |
void |
print(String s) |
void |
println() |
void |
println(boolean x) |
void |
println(char x) |
void |
println(char[] x) |
void |
println(double x) |
void |
println(float x) |
void |
println(int x) |
void |
println(long x) |
void |
println(Object x) |
void |
println(String x) |
static void |
setErr(String filename)
Attempts to replace the standard error stream with a
Logger instance that writes to the named file. |
static void |
setLogger(Logger logger)
Replaces the system logger.
|
static void |
setOut(String filename)
Attempts to replace the standard output stream with a
Logger instance that writes to the named file. |
checkError, clearError, close, flush, format, format, printf, printf, setError, write, writewrite@Deprecated protected PrintStream ous
this.public static final String INFO_STRING
public static final String WARN_STRING
public static final String ERROR_STRING
public static final String DATE_FORMAT
getLogDate().public Logger(Logger target)
public Logger(Logger target, String charset) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic Logger(OutputStream target)
public Logger(OutputStream target, boolean autoFlush)
public Logger(OutputStream target, String charset, boolean autoFlush) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic Logger(Writer target)
public Logger(Writer target, boolean autoFlush)
public Logger(Writer target, String charset, boolean autoFlush) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic void install()
public static void log(String message)
public void logLine()
public Logger append(char value)
append in interface Appendableappend in class PrintStreampublic Logger append(CharSequence value)
append in interface Appendableappend in class PrintStreampublic Logger append(CharSequence value, int start, int end)
append in interface Appendableappend in class PrintStreampublic void print(boolean b)
print in class PrintStreampublic void print(char c)
print in class PrintStreampublic void print(int i)
print in class PrintStreampublic void print(long l)
print in class PrintStreampublic void print(float f)
print in class PrintStreampublic void print(double d)
print in class PrintStreampublic void print(char[] s)
print in class PrintStreampublic void print(String s)
print in class PrintStreampublic void print(Object obj)
print in class PrintStreampublic void println(boolean x)
println in class PrintStreampublic void println(char x)
println in class PrintStreampublic void println(int x)
println in class PrintStreampublic void println(long x)
println in class PrintStreampublic void println(float x)
println in class PrintStreampublic void println(double x)
println in class PrintStreampublic void println(char[] x)
println in class PrintStreampublic void println(String x)
println in class PrintStreampublic void println(Object x)
println in class PrintStreampublic void println()
println in class PrintStreampublic static Logger getLogger()
public static void setLogger(Logger logger)
public static void logErr(String message, Exception ex)
public static void logErr(String message, Throwable ex)
public static void logErr(String message)
public static void logErr(String message, Exception ex, boolean trace)
public static void log(Object object)
public static void logWarn(String message)
public static void logErr(Exception ex)
public static void logInfo(String message)
public static void setOut(String filename)
Logger instance that writes to the named file. If the
operation fails a message will be logged to the system logger and the
method will return without throwing an exception.public static void setErr(String filename)
Logger instance that writes to the named file. If the
operation fails a message will be logged to the system logger and the
method will return without throwing an exception.public static String getLogDate()
io.starter.toolkit.logger.dateformat
exists and is a valid date format pattern it will be used. Otherwise the
default format pattern will be used.Copyright © 2002–2019 Starter Inc.. All rights reserved.