|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groiss.log.Logger
public class Logger
Default implementation of the ILogger interface.
| Field Summary | |
|---|---|
protected static PrintWriter |
err
|
protected static Date |
errdate
|
protected static File |
errfile
|
protected String |
errname
|
protected static long |
errs
|
protected int |
keeperrs
|
protected int |
keeplogs
|
protected static String |
linesep
|
protected static PrintWriter |
log
|
protected static File |
logfile
|
protected String |
logname
|
protected boolean |
logOnConsole
|
protected long |
nextday
|
protected PrintStream |
origout
|
protected boolean |
restartdaily
|
protected boolean |
restarterrdaily
|
protected static int |
trace
|
| Constructor Summary | |
|---|---|
Logger()
|
|
Logger(PrintWriter logger,
int traceLevel)
|
|
| Method Summary | |
|---|---|
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 |
Date |
getLastExceptionDate()
Return the date when the last exception has occured |
int |
getLevel()
Returns the log level. |
File |
getLogFile()
Return the Reader to read the current log file. |
protected String |
getLogPrefix(int level)
Returns the prefix of a log entry (which is the part before the specific log message). |
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(String str)
This method writes the given string into the logfile. |
void |
log(String str,
int level)
This method writes the given string into the logfile. |
void |
logError(Throwable e)
Prints a header line and a stack trace for the given Error or Exception |
void |
logError(Throwable error,
String errHeader)
Prints a header line and a stack trace for the given Error or Exception |
void |
logError(Throwable error,
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 PrintWriter log
protected static PrintWriter err
protected static File logfile
protected static File errfile
protected static int trace
protected static long errs
protected static Date errdate
protected static String linesep
protected boolean logOnConsole
protected String logname
protected String errname
protected int keeplogs
protected int keeperrs
protected long nextday
protected boolean restartdaily
protected boolean restarterrdaily
protected PrintStream origout
| Constructor Detail |
|---|
public Logger()
public Logger(PrintWriter logger,
int traceLevel)
| Method Detail |
|---|
public void shutdown()
Lifecycle
shutdown in interface Lifecyclepublic boolean isRunning()
Service
isRunning in interface Servicepublic void reconfigure()
Service
reconfigure in interface Servicepublic void startup()
Lifecycle
startup in interface Lifecyclepublic void log(String str)
str - string to put into the logfile
public void log(String str,
int level)
log in interface ILoggerstr - string to put into the logfilelevel - the log level, an integer between 0 and 4public void logError(Throwable e)
logError in interface ILogger
public void logError(Throwable error,
String errHeader)
logError in interface ILoggererror - a Throwable objecterrHeader - the text for the header line
public void logError(Throwable error,
String errHeader,
int level)
logError in interface ILoggererror - 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 ILoggerpublic Date getLastExceptionDate()
ILogger
getLastExceptionDate in interface ILoggerpublic File getLogFile()
getLogFile in interface ILoggerpublic File getErrorLogFile()
ILogger
getErrorLogFile in interface ILoggerpublic PrintWriter getWriter()
getWriter in interface ILoggerpublic int getLevel()
getLevel in interface ILoggerpublic void restart()
ILogger
restart in interface ILoggerprotected String getLogPrefix(int level)
level -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||