kieker-monitoring / kieker

Kieker's main repository
Apache License 2.0
70 stars 41 forks source link

[KIEKER-638] Exclude loggers in aop.xml by default? #866

Open rju opened 1 week ago

rju commented 1 week ago

JIRA Issue: KIEKER-638 Exclude loggers in aop.xml by default? Original Reporter: Andre van Hoorn


It seems that especially in Java EE environments, there is a high risk that loggers are woven and lead to stack overflow exceptions. We have an appropriate note in the example aop.xml but this may be missed easily --- especially when the default instrumentation is used. Would it make sense to include these excludes by default?

<!-- 
                     Important: The logger library that is configured to be used by Kieker must always be excluded!
                     (Particularly important when using the include-all directive from above.) 
                --> 
                <!-- <exclude within="org.apache.commons.logging..*" />  -->
                <!-- <exclude within="org.slf4j..*" />  -->
                <!-- <exclude within="java.util.logging..*" />  -->
                <!-- <exclude within="org.apache.log4j..*" />  -->

Checklist:

rju commented 3 days ago

author nils-christian -- Wed, 21 May 2014 09:07:25 +0200

Why does it lead to these exceptions?

If we exclude the loggers, I would suggest to add a suitable information output in our AspectJLoader when the default aop.xml is used.

rju commented 3 days ago

author nils-christian -- Wed, 21 May 2014 09:42:18 +0200

Replying to [nie|comment:1]:
> Why does it lead to these exceptions?

Jan explained it to me: It can lead to infinite loops during the monitoring as it seems.

So, to answer André's question: Yes, it would make sense.

rju commented 3 days ago

author Jan Waller -- Wed, 21 May 2014 09:44:48 +0200

Yes, we can uncomment these lines.
However, we always print a warning that the default instrumentation is not always suited for JavaEE.

rju commented 3 days ago

author André van Hoorn -- Wed, 21 May 2014 14:13:49 +0200

Replying to [jwa|comment:3]:
> Yes, we can uncomment these lines.
> However, we always print a warning that the default instrumentation is not always suited for JavaEE.

Right, but just to avoid the problem that you will very very likely run into this problem in JavaEE while the remaining part of the default configuration works. It is so easy to determine where the stack overflow exception is coming from (got a request about a stack overflow and this immediately solved the problem). I'd suggest to exclude loggers by default by enabling the respective excludes by default. Also, currently the "default instrumentation" seems to be some kind of "magic". Is there a way to log additional information about how the default configuration looks like or where it can be found?

rju commented 3 days ago

author nils-christian -- Thu, 22 May 2014 15:06:26 +0200

Replying to [avh|comment:4]:
> Is there a way to log additional information about how the default configuration looks like or where it can be found?

Sure. One could do something like

LOG.info("No AspectJ configuration file found. Using Kieker's default AspectJ configuration file (META-INF/aop.example.xml).");

or

final URL aspectConfigURL = AspectJLoader.class.getClassLoader().getResource("META-INF/aop.example.xml");
LOG.info("No AspectJ configuration file found. Using Kieker's default AspectJ configuration file (" + aspectConfigURL + ").");

in the AspectJLoader class.

rju commented 3 days ago

author nils-christian -- Thu, 22 May 2014 17:11:50 +0200

Done in 98549675697ba4c529d9708778f9072ddb7d568b.