|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhg.igd.logging.LoggerImpl
This is a generic Logger
implementation which provides the
defined functionality by means of a Wrapper
which depends on the
underlying logging system. Instances are being used as targets of
LoggerProxy
objects.
Field Summary | |
private static Set |
cache_
The storage for all deployed logger objects |
private int |
cnt_
The reference counter |
private String |
fgn_
The formatted group name, ready for printout |
protected String |
group_
The logger group |
protected Wrapper |
wrapper_
The target wrapper |
Constructor Summary | |
private |
LoggerImpl(String name,
String group,
Class wclazz)
Hidden construction. |
Method Summary | |
void |
caught(LogLevel level,
String msg,
Throwable thrown)
This method implicitely calls log(de.fhg.igd.logging.LogLevel, java.lang.String) first, then
caught(Throwable) . |
void |
caught(Throwable thrown)
This method is supposed to be used for logging the catching of a Throwable (and subclasses). |
void |
debug(String msg)
Creates a log entry on LogLevel.DEBUG . |
void |
dismiss()
Removes this LoggerImpl from the cache in case it is
no longer referenced. |
void |
entering()
This method is supposed to be used for logging the entry of a parameterless method. |
void |
entering(Object[] params)
This method is supposed to be used for logging the entry of a method with a set of parameters. |
boolean |
equals(Object obj)
|
void |
error(String msg)
Creates a log entry on LogLevel.ERROR . |
void |
exiting()
This method is supposed to be used for logging the exit of a method without return value. |
void |
exiting(Object result)
This method is supposed to be used for logging the exit of a method with a return value. |
void |
fatal(String msg)
Creates a log entry on LogLevel.FATAL . |
private String |
formatCaught(Throwable thrown)
Create a generic message for a caught Throwable . |
private String |
formatGenericMessage(StringBuffer buf)
Create a generic message using the group name and the current SourceLocation . |
private String |
formatMethodEntry(Object[] params)
Create a generic message for a method entry event. |
private String |
formatMethodExit(Object result)
Create a generic message for a method exit event. |
private StringBuffer |
formatStackTrace(Throwable thrown)
Create a printout for a Throwable . |
private String |
formatThrowing(Throwable thrown)
Create a generic message for a Throwable that will
cause a method exit. |
String |
getGroup()
|
Wrapper |
getWrapper()
|
int |
hashCode()
|
void |
info(String msg)
Creates a log entry on LogLevel.INFO . |
boolean |
isEnabled(LogLevel level)
Find out if logging would be performed at the given log level. |
void |
log(LogLevel level,
String msg)
This is the generic log method to be used for creating a log entry on the specified log level. |
(package private) static LoggerImpl |
requestFor(String name,
String group,
Class wclazz)
Request a LoggerImpl instance. |
void |
severe(String msg)
Creates a log entry on LogLevel.SEVERE . |
void |
throwing(LogLevel level,
String msg,
Throwable thrown)
This method implicitely calls log(de.fhg.igd.logging.LogLevel, java.lang.String) first, then
throwing(Throwable) . |
void |
throwing(Throwable thrown)
This method is supposed to be used for logging the creation and method exit by a Throwable (and subclasses). |
String |
toString()
|
void |
trace(String msg)
Creates a log entry on LogLevel.TRACE . |
void |
warning(String msg)
Creates a log entry on LogLevel.WARNING . |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
private static Set cache_
private int cnt_
protected String group_
private String fgn_
protected Wrapper wrapper_
Constructor Detail |
private LoggerImpl(String name, String group, Class wclazz)
name
- The logger namegroup
- The logger groupwclazz
- The Wrapper
implementation class to be usedMethod Detail |
static LoggerImpl requestFor(String name, String group, Class wclazz)
LoggerImpl
instance.
wclazz
- The Wrapper
implementation class to be usedname
- The logger namegroup
- The logger grouppublic String getGroup()
public Wrapper getWrapper()
public void log(LogLevel level, String msg)
Logger
log
in interface Logger
level
- The log level to be used for creating the log entrymsg
- The message to be written into the log entrypublic void trace(String msg)
Logger
LogLevel.TRACE
.
trace
in interface Logger
msg
- The message to be written into the log entrypublic void debug(String msg)
Logger
LogLevel.DEBUG
.
debug
in interface Logger
msg
- The message to be written into the log entrypublic void info(String msg)
Logger
LogLevel.INFO
.
info
in interface Logger
msg
- The message to be written into the log entrypublic void warning(String msg)
Logger
LogLevel.WARNING
.
warning
in interface Logger
msg
- The message to be written into the log entrypublic void error(String msg)
Logger
LogLevel.ERROR
.
error
in interface Logger
msg
- The message to be written into the log entrypublic void severe(String msg)
Logger
LogLevel.SEVERE
.
severe
in interface Logger
msg
- The message to be written into the log entrypublic void fatal(String msg)
Logger
LogLevel.FATAL
.
fatal
in interface Logger
msg
- The message to be written into the log entrypublic void entering()
Logger
LogLevel.TRACE
.
entering
in interface Logger
public void entering(Object[] params)
Logger
LogLevel.TRACE
.
entering
in interface Logger
params
- The method parameters, for printing the
toString()
method will be called on each objectpublic void exiting()
Logger
LogLevel.TRACE
.
exiting
in interface Logger
public void exiting(Object result)
Logger
LogLevel.TRACE
.
exiting
in interface Logger
result
- The return value, for printing the
toString()
method will be calledpublic void throwing(Throwable thrown)
Logger
Throwable
(and subclasses). Hereby, the used
log level will be LogLevel.TRACE
.
throwing
in interface Logger
thrown
- The exception that will be thrownpublic void throwing(LogLevel level, String msg, Throwable thrown)
Logger
Logger.log(de.fhg.igd.logging.LogLevel, java.lang.String)
first, then
Logger.throwing(Throwable)
.
throwing
in interface Logger
level
- The log level to be used for creating the log entrymsg
- The message to be written into the log entrythrown
- The exception that will be thrownpublic void caught(Throwable thrown)
Logger
Throwable
(and subclasses). Hereby, the used
log level will be LogLevel.TRACE
.
caught
in interface Logger
thrown
- The exception that has been caughtpublic void caught(LogLevel level, String msg, Throwable thrown)
Logger
Logger.log(de.fhg.igd.logging.LogLevel, java.lang.String)
first, then
Logger.caught(Throwable)
.
caught
in interface Logger
level
- The log level to be used for creating the log entrymsg
- The message to be written into the log entrythrown
- The exception that has been caughtpublic boolean isEnabled(LogLevel level)
Logger
This method might be useful in cases of costly log message creation which should be performed only if really needed.
isEnabled
in interface Logger
level
- The log level to check for
public void dismiss()
LoggerImpl
from the cache in case it is
no longer referenced.
private String formatGenericMessage(StringBuffer buf)
SourceLocation
.
buf
- The plain message text
private String formatMethodEntry(Object[] params)
params
- The method's parameter values
private String formatMethodExit(Object result)
result
- The method's return value
private String formatThrowing(Throwable thrown)
Throwable
that will
cause a method exit.
thrown
- The stacktrace origin to be thrown
private String formatCaught(Throwable thrown)
Throwable
.
thrown
- The stacktrace origin that got caught
private StringBuffer formatStackTrace(Throwable thrown)
Throwable
.
thrown
- The stacktrace origin
public boolean equals(Object obj)
public int hashCode()
public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |