|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.sasl.aop.AbstractRootAspect net.sf.sasl.aop.AbstractPlaceholderScriptUsingAspect net.sf.sasl.aop.logging.GenericLogAspect
public class GenericLogAspect
The task that this aspect addresses is to log informations in a generic way for the three different phases of a target method "call":
RuntimeBenchIEnvOfferer
which offers the total runtime of a target method
call as a variable.
<bean id="logAspect" class="net.sf.sasl.aop.logging.GenericLogAspect">
...
<property name="logConfiguration">
<list>
<!-- Configuration for logging the exception case of a target method execution-->
<bean class="net.sf.sasl.aop.logging.LogConfigBean">
<property name="executionPhaseSet">
<set>
<value>EXCEPTION</value>
</set>
</property>
<property name="logTextList">
<list>
<value>%exceptionStackTrace</value>
</list>
</property>
<property name="loggerConfigMap">
<map>
<entry key="de.example.ServiceCallLogger" value="ERROR" />
<entry key="de.example.ExceptionLogger" value="ERROR" />
</map>
</property>
</bean>
<!-- Configuration for logging call and runtime informations in success and exception case of the target method execution-->
<bean class="net.sf.sasl.aop.logging.LogConfigBean">
<property name="executionPhaseSet">
<set>
<value>SUCCESS</value>
<value>EXCEPTION</value>
</set>
</property>
<property name="logTextList">
<list>
<value>%targetClassName->%targetMethodName(%targetMethodParameterTypes) : %duration{'mm:ss.SSS', %iEnv{'runtimeBenchMillis'}}</value>
</list>
</property>
<property name="loggerConfigMap">
<map>
<entry key="de.example.ServiceCallLogger" value="INFO" />
</map>
</property>
</bean>
<!-- ... more configurations for example for tracing/debug ... -->
</list>
</property>
</bean>
net.sf.sasl.aop.common.grammar.placeholder.resolver
Field Summary |
---|
Fields inherited from class net.sf.sasl.aop.AbstractPlaceholderScriptUsingAspect |
---|
placeholderSymbolTable |
Fields inherited from class net.sf.sasl.aop.AbstractRootAspect |
---|
logger |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
GenericLogAspect()
|
Method Summary | |
---|---|
protected void |
doLogging(long sessionId,
TargetMethodExecutionPhase executionPhase,
org.aopalliance.intercept.MethodInvocation invocation,
Object returnValue,
Throwable occuredException)
Does the logging for a (executionPhase, invocation, ...) tuple. |
protected void |
endLogSessionIEnvOfferer(long sessionId)
Ends the log session identified with the session id at all registered interpreter environment variable offerer. |
protected Map<TargetMethodExecutionPhase,List<LogConfiguration>> |
getConfigurationLookupMap()
Returns a copy of the (execution phase, log configurations) lookup map. |
List<ILogSessionIEnvOfferer> |
getLogSessionIEnvOffererList()
|
Object |
invoke(org.aopalliance.intercept.MethodInvocation invocation)
Please see the class header javadoc for more informations what this method does. |
protected boolean |
isALoggerEnabledForConfiguration(Map<org.slf4j.Logger,LogLevel> loggerMap)
Returns true, if there exists a logger in the map that is enabled for the associated log level. |
protected boolean |
isLoggerEnabledFor(org.slf4j.Logger logger,
LogLevel logLevel)
Returns true, if the given log level is enabled for the given logger. |
protected void |
logOverLogger(org.slf4j.Logger logger,
LogLevel logLevel,
String message)
Logs a log message with the given log level over the given logger. |
protected void |
logOverLoggers(Map<org.slf4j.Logger,LogLevel> loggerMap,
String message,
boolean oneLogLinePerLine)
Logs a log message over the all loggers which are contained in the map with the associated log level for each logger. |
void |
setLogConfiguration(List<LogConfigBean> configurationList)
Sets a list of log configurations which define what and how should be logged by the aspect. |
void |
setLogSessionIEnvOffererList(List<ILogSessionIEnvOfferer> logSessionIEnvOffererList)
Sets a list of interpreter environment variable offerer which can offer additional environment variables during a log session. |
protected void |
startLogSessionIEnvOfferer(long sessionId)
Starts a new log session at all registered interpreter environment variable offerer with the given session id. |
Methods inherited from class net.sf.sasl.aop.AbstractPlaceholderScriptUsingAspect |
---|
getPlaceholderSymbolTable, runInterpreter, setPlaceholderResolverList |
Methods inherited from class net.sf.sasl.aop.AbstractRootAspect |
---|
getLogger, getOrder, setLogger, setLoggerByName, setOrder |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericLogAspect()
Method Detail |
---|
public Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable
invoke
in interface org.aopalliance.intercept.MethodInterceptor
Throwable
MethodInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)
protected void startLogSessionIEnvOfferer(long sessionId)
sessionId
- any long valueprotected void endLogSessionIEnvOfferer(long sessionId)
sessionId
- any long valueprotected void doLogging(long sessionId, TargetMethodExecutionPhase executionPhase, org.aopalliance.intercept.MethodInvocation invocation, Object returnValue, Throwable occuredException) throws InterpreterException
sessionId
- any long value.executionPhase
- non null.invocation
- non null.returnValue
- null or non null.occuredException
- null or non null.
InterpreterException
- if an exeception occurs during interpreting the placeholder
log script.public void setLogConfiguration(List<LogConfigBean> configurationList) throws ParseException, IllegalArgumentException
LogConfigBean
class for
more details of which parts a log configuration exists and what those
parts mean.
configurationList
- non null.
ParseException
- if a parse error occurs during parsing the log texts as a
placeholder script.
IllegalArgumentException
- if configurationList is null.public List<ILogSessionIEnvOfferer> getLogSessionIEnvOffererList()
setLogSessionIEnvOffererList(List)
public void setLogSessionIEnvOffererList(List<ILogSessionIEnvOfferer> logSessionIEnvOffererList) throws IllegalArgumentException
logSessionIEnvOffererList
- non null.
IllegalArgumentException
- if logSessionIEnvOffererList is null.protected Map<TargetMethodExecutionPhase,List<LogConfiguration>> getConfigurationLookupMap()
protected void logOverLogger(org.slf4j.Logger logger, LogLevel logLevel, String message)
logger
- non nulllogLevel
- non nullmessage
- null or non nullprotected void logOverLoggers(Map<org.slf4j.Logger,LogLevel> loggerMap, String message, boolean oneLogLinePerLine)
loggerMap
- non null.message
- non null.oneLogLinePerLine
- true or false.protected boolean isLoggerEnabledFor(org.slf4j.Logger logger, LogLevel logLevel)
logger
- non null.logLevel
- non null.
protected boolean isALoggerEnabledForConfiguration(Map<org.slf4j.Logger,LogLevel> loggerMap)
loggerMap
- non null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |