|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.groiss.log.Logger
public class Logger
Default implementation of the ILogger interface.
Field Summary | |
---|---|
protected static java.io.PrintWriter |
err
|
protected static java.util.Date |
errdate
|
protected static java.io.File |
errfile
|
protected java.lang.String |
errname
|
protected static long |
errs
|
protected int |
keeperrs
|
protected int |
keeplogs
|
protected static java.lang.String |
linesep
|
protected static java.io.PrintWriter |
log
|
protected static java.io.File |
logfile
|
protected java.lang.String |
logname
|
protected boolean |
logOnConsole
|
protected long |
nextday
|
protected java.io.PrintStream |
origout
|
protected boolean |
restartdaily
|
protected boolean |
restarterrdaily
|
protected static int |
trace
|
Constructor Summary | |
---|---|
Logger()
|
|
Logger(java.io.PrintWriter logger,
int traceLevel)
|
Method Summary | |
---|---|
java.io.File |
getErrorLogFile()
The file where errors are logged, if errors are logged to a separate file. |
long |
getExceptionCount()
Return the number of exceptions since startup |
java.util.Date |
getLastExceptionDate()
Return the date when the last exception has occured |
int |
getLevel()
Returns the log level. |
java.io.File |
getLogFile()
Return the Reader to read the current log file. |
protected java.lang.String |
getLogPrefix(int level)
Returns the prefix of a log entry (which is the part before the specific log message). |
java.io.PrintWriter |
getWriter()
Return the Writer to write some stuff to the log file. |
boolean |
isRunning()
Ask the object if it has been started |
void |
log(java.lang.String str)
This method writes the given string into the logfile. |
void |
log(java.lang.String str,
int level)
This method writes the given string into the logfile. |
void |
logError(java.lang.Throwable e)
Prints a header line and a stack trace for the given Error or Exception |
void |
logError(java.lang.Throwable error,
java.lang.String errHeader)
Prints a header line and a stack trace for the given Error or Exception |
void |
logError(java.lang.Throwable error,
java.lang.String errHeader,
int level)
Prints a header line and a stack trace for the given Error or Exception |
void |
reconfigure()
Reconfigure gives the service the chance to react on configuration changes. |
void |
restart()
Restart the Logger (reinitialize log file) |
void |
shutdown()
This method is called on shutdown. |
void |
startup()
This method is called when the object is "started". |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.io.PrintWriter log
protected static java.io.PrintWriter err
protected static java.io.File logfile
protected static java.io.File errfile
protected static int trace
protected static long errs
protected static java.util.Date errdate
protected static java.lang.String linesep
protected boolean logOnConsole
protected java.lang.String logname
protected java.lang.String errname
protected int keeplogs
protected int keeperrs
protected long nextday
protected boolean restartdaily
protected boolean restarterrdaily
protected java.io.PrintStream origout
Constructor Detail |
---|
public Logger()
public Logger(java.io.PrintWriter logger, int traceLevel)
Method Detail |
---|
public void shutdown()
Lifecycle
shutdown
in interface Lifecycle
public boolean isRunning()
Service
isRunning
in interface Service
public void reconfigure()
Service
reconfigure
in interface Service
public void startup()
Lifecycle
startup
in interface Lifecycle
public void log(java.lang.String str)
str
- string to put into the logfilepublic void log(java.lang.String str, int level)
log
in interface ILogger
str
- string to put into the logfilelevel
- the log level, an integer between 0 and 4public void logError(java.lang.Throwable e)
logError
in interface ILogger
public void logError(java.lang.Throwable error, java.lang.String errHeader)
logError
in interface ILogger
error
- a Throwable objecterrHeader
- the text for the header linepublic void logError(java.lang.Throwable error, java.lang.String errHeader, int level)
logError
in interface ILogger
error
- a Throwable objecterrHeader
- the text for the header linelevel
- an integer between 0 and 4. The exception is logged if greater or equal the log level,public long getExceptionCount()
ILogger
getExceptionCount
in interface ILogger
public java.util.Date getLastExceptionDate()
ILogger
getLastExceptionDate
in interface ILogger
public java.io.File getLogFile()
getLogFile
in interface ILogger
public java.io.File getErrorLogFile()
ILogger
getErrorLogFile
in interface ILogger
public java.io.PrintWriter getWriter()
getWriter
in interface ILogger
public int getLevel()
getLevel
in interface ILogger
public void restart()
ILogger
restart
in interface ILogger
protected java.lang.String getLogPrefix(int level)
level
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |