Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2010-06-22 12:11:28 +0000
committerGlyn Normington2010-06-22 12:11:28 +0000
commitad6eff2ab856d066dd78b33834eecaac992d65e9 (patch)
tree5d2a0fa7c41bfa8916a589199b108f1179ba1760 /org.eclipse.virgo.medic/src
parent2a717bd9587edc4108be030621a7276e32f03c7e (diff)
downloadorg.eclipse.virgo.medic-ad6eff2ab856d066dd78b33834eecaac992d65e9.tar.gz
org.eclipse.virgo.medic-ad6eff2ab856d066dd78b33834eecaac992d65e9.tar.xz
org.eclipse.virgo.medic-ad6eff2ab856d066dd78b33834eecaac992d65e9.zip
avoid infinite recursion during class loading during logging
Diffstat (limited to 'org.eclipse.virgo.medic/src')
-rw-r--r--org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/EntryExitTrace.aj163
1 files changed, 88 insertions, 75 deletions
diff --git a/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/EntryExitTrace.aj b/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/EntryExitTrace.aj
index 7b0b1d8..1687a5a 100644
--- a/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/EntryExitTrace.aj
+++ b/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/EntryExitTrace.aj
@@ -24,80 +24,93 @@ import org.slf4j.LoggerFactory;
*
*/
public aspect EntryExitTrace pertypewithin(*) {
-
+
private volatile Logger logger;
-
- pointcut medic() : within(org.eclipse.virgo.medic..*);
-
- pointcut util() : within(org.eclipse.virgo.util..*);
-
- pointcut repository() : within(org.eclipse.virgo.repository..*);
-
- pointcut logback() : within(ch.qos.logback..*) || within(org.slf4j.impl..*);
-
- pointcut setter() : execution(* set*(..));
-
- pointcut getter() : execution(* get*(..));
-
- pointcut infoCandidate() : execution(public * *(..)) && !setter() && !getter() && !medic() && !util() && !repository() && !logback();
-
- pointcut debugCandidate() : execution(!public !private * *(..)) && !setter() && !getter() && !medic() && !util() && !repository() && !logback();
-
- pointcut traceCandidate() : execution(private * *(..)) && !setter() && !getter() && !medic() && !util() && !repository() && !logback();
-
- before() : infoCandidate() {
- getLogger(thisJoinPointStaticPart).info("{} {}", ">", getSignature(thisJoinPointStaticPart));
- }
-
- after() returning : infoCandidate() {
- getLogger(thisJoinPointStaticPart).info("{} {}", "<", getSignature(thisJoinPointStaticPart));
- }
-
- after() throwing(Throwable t) : infoCandidate() {
- Logger logger = getLogger(thisJoinPointStaticPart);
- if (logger.isInfoEnabled()) {
- logger.info(String.format("< %s", getSignature(thisJoinPointStaticPart)), t);
- }
- }
-
- before() : debugCandidate() {
- getLogger(thisJoinPointStaticPart).debug("{} {}", ">", getSignature(thisJoinPointStaticPart));
- }
-
- after() returning : debugCandidate() {
- getLogger(thisJoinPointStaticPart).debug("{} {}", "<", getSignature(thisJoinPointStaticPart));
- }
-
- after() throwing(Throwable t) : debugCandidate() {
- Logger logger = getLogger(thisJoinPointStaticPart);
- if (logger.isDebugEnabled()) {
- logger.debug(String.format("< %s", getSignature(thisJoinPointStaticPart)), t);
- }
- }
-
- before() : traceCandidate() {
- getLogger(thisJoinPointStaticPart).trace("{} {}", ">", getSignature(thisJoinPointStaticPart));
- }
-
- after() returning : traceCandidate() {
- getLogger(thisJoinPointStaticPart).trace("{} {}", "<", getSignature(thisJoinPointStaticPart));
- }
-
- after() throwing(Throwable t) : traceCandidate() {
- Logger logger = getLogger(thisJoinPointStaticPart);
- if (logger.isTraceEnabled()) {
- logger.trace(String.format("< %s", getSignature(thisJoinPointStaticPart)), t);
- }
- }
-
- private Logger getLogger(JoinPoint.StaticPart sp) {
- if (this.logger == null) {
- this.logger = LoggerFactory.getLogger(sp.getSignature().getDeclaringType());
- }
- return this.logger;
- }
-
- private String getSignature(JoinPoint.StaticPart sp) {
- return sp.getSignature().toLongString();
- }
+
+ pointcut medic() : within(org.eclipse.virgo.medic..*);
+
+ pointcut util() : within(org.eclipse.virgo.util..*);
+
+ pointcut repository() : within(org.eclipse.virgo.repository..*);
+
+ // avoid class loading recursion
+ pointcut kernelUserRegion() : within(org.eclipse.virgo.kernel.userregion..*);
+
+ pointcut logback() : within(ch.qos.logback..*) || within(org.slf4j.impl..*);
+
+ pointcut setter() : execution(* set*(..));
+
+ pointcut getter() : execution(* get*(..));
+
+ pointcut infoCandidate() : execution(public * *(..)) && !setter() && !getter() && !medic() && !util() && !repository() && !kernelUserRegion() && !logback();
+
+ pointcut debugCandidate() : execution(!public !private * *(..)) && !setter() && !getter() && !medic() && !util() && !repository() && !kernelUserRegion() && !logback();
+
+ pointcut traceCandidate() : execution(private * *(..)) && !setter() && !getter() && !medic() && !util() && !repository() && !kernelUserRegion() && !logback();
+
+ before() : infoCandidate() {
+ getLogger(thisJoinPointStaticPart).info("{} {}", ">",
+ getSignature(thisJoinPointStaticPart));
+ }
+
+ after() returning : infoCandidate() {
+ getLogger(thisJoinPointStaticPart).info("{} {}", "<",
+ getSignature(thisJoinPointStaticPart));
+ }
+
+ after() throwing(Throwable t) : infoCandidate() {
+ Logger logger = getLogger(thisJoinPointStaticPart);
+ if (logger.isInfoEnabled()) {
+ logger.info(String.format("< %s",
+ getSignature(thisJoinPointStaticPart)), t);
+ }
+ }
+
+ before() : debugCandidate() {
+ getLogger(thisJoinPointStaticPart).debug("{} {}", ">",
+ getSignature(thisJoinPointStaticPart));
+ }
+
+ after() returning : debugCandidate() {
+ getLogger(thisJoinPointStaticPart).debug("{} {}", "<",
+ getSignature(thisJoinPointStaticPart));
+ }
+
+ after() throwing(Throwable t) : debugCandidate() {
+ Logger logger = getLogger(thisJoinPointStaticPart);
+ if (logger.isDebugEnabled()) {
+ logger.debug(String.format("< %s",
+ getSignature(thisJoinPointStaticPart)), t);
+ }
+ }
+
+ before() : traceCandidate() {
+ getLogger(thisJoinPointStaticPart).trace("{} {}", ">",
+ getSignature(thisJoinPointStaticPart));
+ }
+
+ after() returning : traceCandidate() {
+ getLogger(thisJoinPointStaticPart).trace("{} {}", "<",
+ getSignature(thisJoinPointStaticPart));
+ }
+
+ after() throwing(Throwable t) : traceCandidate() {
+ Logger logger = getLogger(thisJoinPointStaticPart);
+ if (logger.isTraceEnabled()) {
+ logger.trace(String.format("< %s",
+ getSignature(thisJoinPointStaticPart)), t);
+ }
+ }
+
+ private Logger getLogger(JoinPoint.StaticPart sp) {
+ if (this.logger == null) {
+ this.logger = LoggerFactory.getLogger(sp.getSignature()
+ .getDeclaringType());
+ }
+ return this.logger;
+ }
+
+ private String getSignature(JoinPoint.StaticPart sp) {
+ return sp.getSignature().toLongString();
+ }
}

Back to the top