Description of changes:
Refactored the trace ID injection logic to try to enable it once during premain, and again while handling the first instrumented request. This allows us to check for the trace ID injection classes (Log4JSegmentListener and SLF4JSegmentListener) using the customer app's class loader, in case they're using a custom one, as is the case for Spring Boot apps.
In the future, as I noted in my TODO task, we should bundle those two classes in the Agent JAR and enable trace ID injection by default so long as the corresponding logging library (Log4J or SLF4J) is available on the customer's class loader. But this was a little too much work for now.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Issue #, if available:
74
Description of changes: Refactored the trace ID injection logic to try to enable it once during premain, and again while handling the first instrumented request. This allows us to check for the trace ID injection classes (Log4JSegmentListener and SLF4JSegmentListener) using the customer app's class loader, in case they're using a custom one, as is the case for Spring Boot apps.
In the future, as I noted in my TODO task, we should bundle those two classes in the Agent JAR and enable trace ID injection by default so long as the corresponding logging library (Log4J or SLF4J) is available on the customer's class loader. But this was a little too much work for now.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.