Skip to content

feat(log4js): added option to capture info logs#2659

Open
aryamohanan wants to merge 2 commits into
mainfrom
feat-log4js
Open

feat(log4js): added option to capture info logs#2659
aryamohanan wants to merge 2 commits into
mainfrom
feat-log4js

Conversation

@aryamohanan

@aryamohanan aryamohanan commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for capturing info-level logs for log4js. By default, log capture starts at WARN and above. When configured, INFO logs can also be captured.

Reference: https://github.com/log4js-node/log4js-node/blob/master/lib/levels.js#L96

https://log4js-node.github.io/log4js-node/api.html

Configuration

The log capture level can be configured using either:

  • Environment variable: INSTANA_TRACING_CAPTURE_LOG_LEVEL
  • In-code configuration: tracing.captureLogLevel

Supported values:

  • INFO
  • WARN (default)
  • ERROR
  • OFF

Log capture behavior

Configuration Captured log levels
INFO INFO, WARN, ERROR, FATAL
WARN WARN, ERROR, FATAL
ERROR ERROR, FATAL
OFF No log spans are captured.

ref: https://jsw.ibm.com/browse/INSTA-101942
tech spec: https://github.ibm.com/instana/technical-documentation/blob/master/tracing/specification/README.md#log-spans

Comment thread packages/core/src/tracing/instrumentation/logging/log4js.js
@aryamohanan
aryamohanan marked this pull request as ready for review July 17, 2026 05:54
@aryamohanan
aryamohanan requested a review from a team as a code owner July 17, 2026 05:54
Comment thread packages/core/src/tracing/instrumentation/logging/log4js.js Outdated
Comment thread packages/core/src/tracing/instrumentation/logging/log4js.js Outdated
@sonarqubecloud

Copy link
Copy Markdown

@aryamohanan
aryamohanan requested a review from kirrg001 July 20, 2026 13:17
Comment thread packages/core/src/tracing/instrumentation/logging/log4js.js Outdated
@aryamohanan aryamohanan changed the title feat(log4js): added option to capture info logs chore(log4js): added option to capture info logs Jul 23, 2026
@aryamohanan aryamohanan changed the title chore(log4js): added option to capture info logs feat(log4js): added option to capture info logs Jul 23, 2026
@aryamohanan
aryamohanan force-pushed the feat-log4js branch 2 times, most recently from de33fe1 to a79738e Compare July 23, 2026 13:18
@aryamohanan
aryamohanan requested a review from kirrg001 July 23, 2026 13:18
@aryamohanan

Copy link
Copy Markdown
Contributor Author

I will merge this as 2 commits

  • chore: added helper to determine error log levels
  • feat(log4js): added option to capture info logs

return originalLog.apply(this, arguments);
}

return instrumentedLog(this, data, originalLog, level);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return instrumentedLog(this, data, originalLog, level);
return instrumentedLog(this, data, originalLog, levelName);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants