Thanks to visit codestin.com
Credit goes to github.com

Skip to content

INSTRUMENTATION_LOGGING_LEVEL suppresses exceptions to be recorded #4095

@progxaker

Description

@progxaker

Expected behavior

Exceptions are recorded regardless of what level is specified by the APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL variable.

Actual behavior

When the APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL variable is set to OFF, exceptions are filtered out.
Auto-collected exceptions or those recorded with recordException() are exported since there is an AgentSpanExporter log, but they do not appear in the App Insights UI.
UPD: checked with FATAL level, also doesn't work, but it works with ERROR.

References

  • On the "Configuration options: Azure Monitor Application Insights for Java" page, it says:

    Log4j, Logback, JBoss Logging, and java.util.logging are autoinstrumented. Logging performed via these logging frameworks is autocollected.

    and the variable can be used to set the level.

  • On the "Exceptions | OpenTelemetry" page, it says:

    An exception SHOULD be recorded as an Event on the span during which it occurred if and only if it remains unhandled when the span ends and causes the span status to be set to ERROR.

  • I can see a reason why disabled logging filters exceptions (because exceptions are actually events), but I don't think it's a clear behavior.

  • On the "Sampling overrides - Azure Monitor Application Insights for Java" page, it says:

    telemetryType (telemetryKind in Application Insights 3.4.0) must be one of request, dependency, trace (log), or exception.

    where the exception is of a different type from trace (log; events) and therefore must be recorded in a different way.

To Reproduce

  1. Exceptions appear when slf4j is not used - issue-4095/exceptions-without-slf4j/.
  2. Exceptions disappear when slf4j is used - issue-4095/no-exceptions-with-slf4j/.

System information

  • SDK Version: 3.7.0
  • OS type and version: Linux
  • Using spring-boot? No
  • Additional relevant libraries (with version, if applicable): org.slf4j:slf4j-api, io.opentelemetry:opentelemetry-api, io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations.

Logs

Screenshots

LOGGING_LEVEL is OFF and slf4j is used:
Image

LOGGING_LEVEL is still OFF, but slf4j is removed:
Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions