Skip to content

codeless instrumentation of log4j2 breaks when AsyncLoggerContextSelector is set as contextSelector #1389

@vargadan

Description

@vargadan

Expected behavior

Log4j2 log entries sent to the application insights workspace as trace entries.

Actual behavior

Log4j2 entries were not sent when relying on only codeless instrumentation with the 3.0.0 agent.
However, they were when configuring the AI appender in the log4j2.xml explicitly.

To Reproduce

Steps to reproduce the behavior:
add the -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector system property, you will see that log4j2 entries no more are sent to AI workspace as application trace.

Sample Application

https://github.com/vargadan/ai-log4j-reproducer

System information

Please provide the following information:

  • SDK Version: agent 3.0.0
  • OS type and version: Ubuntu 18.04
  • Application Server type and version (if applicable): Tomcat 9 (as of the current tomcat:jdk11-openjdk-slim image)
  • Using spring-boot? NO
  • Additional relevant libraries (with version, if applicable):
    log4j2 2.14.0

Logs

Turn on SDK logs and attach/paste them to the issue. If using an application server, also attach any relevant server logs.

Be sure to remove any private information from the logs before posting!

Screenshots

If applicable, add screenshots to help explain your problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions