Skip to content

fix(startup-log): send startup logs to stderr#7502

Merged
bm1549 merged 1 commit intomasterfrom
brian.marks/startup-log-stderr-only
Feb 12, 2026
Merged

fix(startup-log): send startup logs to stderr#7502
bm1549 merged 1 commit intomasterfrom
brian.marks/startup-log-stderr-only

Conversation

@bm1549
Copy link
Copy Markdown
Contributor

@bm1549 bm1549 commented Feb 12, 2026

What does this PR do?

Changes startup logs to output to stderr (via console.warn) instead of stdout (via console.info), following Unix conventions and aligning with other Datadog language tracers.

This PR addresses only the stderr output change from #7470, which was reverted in #7478 due to a regression introduced by the immediate emission timing change. This PR does NOT modify when the logs are emitted - they continue to be emitted on the first payload sent to the agent (same timing as before).

Changing the timing of logs will be done in a future PR

Motivation

Diagnostic and informational logs should be sent to stderr rather than stdout, following standard Unix conventions. This aligns with how other Datadog language tracers handle startup logs.

Additional Notes

Related PRs:

This PR includes only the safe stderr output change without the problematic timing modification.

How to test the change?

Run the startup-log tests:

node scripts/mocha-run-file.js packages/dd-trace/test/startup-log.spec.js

All tests should pass and verify that startup logs use console.warn (stderr) instead of console.info (stdout).

🤖 Generated with Claude Code

@bm1549 bm1549 requested a review from a team as a code owner February 12, 2026 01:52
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 12, 2026

Overall package size

Self size: 4.59 MB
Deduped: 5.43 MB
No deduping: 5.43 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.6 | 81.92 kB | 813.08 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.28%. Comparing base (5de82d7) to head (4c13de7).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7502   +/-   ##
=======================================
  Coverage   80.28%   80.28%           
=======================================
  Files         731      731           
  Lines       31152    31152           
=======================================
  Hits        25009    25009           
  Misses       6143     6143           
Flag Coverage Δ
aiguard-macos 39.06% <50.00%> (-0.11%) ⬇️
aiguard-ubuntu 39.18% <50.00%> (-0.11%) ⬇️
aiguard-windows 38.92% <50.00%> (-0.11%) ⬇️
apm-capabilities-tracing-macos 48.79% <100.00%> (ø)
apm-capabilities-tracing-ubuntu 48.82% <100.00%> (ø)
apm-capabilities-tracing-windows 48.47% <100.00%> (-0.05%) ⬇️
apm-integrations-child-process 38.64% <50.00%> (-0.11%) ⬇️
apm-integrations-couchbase-18 37.39% <50.00%> (-0.10%) ⬇️
apm-integrations-couchbase-eol 37.88% <50.00%> (-0.25%) ⬇️
apm-integrations-oracledb 38.04% <50.00%> (-0.10%) ⬇️
appsec-express 55.45% <50.00%> (-0.08%) ⬇️
appsec-fastify 52.02% <50.00%> (-0.08%) ⬇️
appsec-graphql 52.40% <50.00%> (-0.07%) ⬇️
appsec-kafka 44.63% <50.00%> (-0.09%) ⬇️
appsec-ldapjs 44.38% <50.00%> (-0.09%) ⬇️
appsec-lodash 44.06% <50.00%> (-0.09%) ⬇️
appsec-macos 58.51% <50.00%> (-0.07%) ⬇️
appsec-mongodb-core 49.17% <50.00%> (-0.20%) ⬇️
appsec-mongoose 49.97% <50.00%> (-0.07%) ⬇️
appsec-mysql 51.35% <50.00%> (-0.08%) ⬇️
appsec-node-serialize 43.58% <50.00%> (-0.09%) ⬇️
appsec-passport 48.15% <50.00%> (-0.09%) ⬇️
appsec-postgres 51.14% <50.00%> (-0.08%) ⬇️
appsec-sourcing 42.92% <50.00%> (-0.09%) ⬇️
appsec-template 43.75% <50.00%> (-0.09%) ⬇️
appsec-ubuntu 58.59% <50.00%> (-0.07%) ⬇️
appsec-windows 58.37% <50.00%> (-0.07%) ⬇️
instrumentations-instrumentation-bluebird 32.32% <50.00%> (-0.11%) ⬇️
instrumentations-instrumentation-body-parser 40.85% <50.00%> (-0.10%) ⬇️
instrumentations-instrumentation-child_process 37.95% <50.00%> (-0.11%) ⬇️
instrumentations-instrumentation-cookie-parser 34.55% <50.00%> (-0.10%) ⬇️
instrumentations-instrumentation-express 34.89% <50.00%> (-0.10%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 34.68% <50.00%> (-0.10%) ⬇️
instrumentations-instrumentation-express-session 40.47% <50.00%> (-0.10%) ⬇️
instrumentations-instrumentation-fs 31.92% <50.00%> (-0.11%) ⬇️
instrumentations-instrumentation-generic-pool 30.20% <ø> (ø)
instrumentations-instrumentation-http 39.66% <50.00%> (-0.10%) ⬇️
instrumentations-instrumentation-knex 32.32% <50.00%> (-0.11%) ⬇️
instrumentations-instrumentation-mongoose 33.66% <50.00%> (-0.10%) ⬇️
instrumentations-instrumentation-multer 40.59% <50.00%> (-0.10%) ⬇️
instrumentations-instrumentation-mysql2 38.33% <50.00%> (-0.10%) ⬇️
instrumentations-instrumentation-passport 44.45% <50.00%> (-0.09%) ⬇️
instrumentations-instrumentation-passport-http 44.10% <50.00%> (-0.09%) ⬇️
instrumentations-instrumentation-passport-local 44.66% <50.00%> (-0.09%) ⬇️
instrumentations-instrumentation-pg 37.85% <50.00%> (-0.11%) ⬇️
instrumentations-instrumentation-promise 32.25% <50.00%> (-0.11%) ⬇️
instrumentations-instrumentation-promise-js 32.26% <50.00%> (-0.11%) ⬇️
instrumentations-instrumentation-q 32.30% <50.00%> (-0.11%) ⬇️
instrumentations-instrumentation-url 32.22% <50.00%> (-0.11%) ⬇️
instrumentations-instrumentation-when 32.27% <50.00%> (-0.11%) ⬇️
llmobs-ai 41.61% <50.00%> (+0.04%) ⬆️
llmobs-anthropic 40.66% <50.00%> (-0.10%) ⬇️
llmobs-bedrock 39.54% <50.00%> (-0.09%) ⬇️
llmobs-google-genai 40.16% <50.00%> (-0.09%) ⬇️
llmobs-langchain 39.69% <50.00%> (-0.08%) ⬇️
llmobs-openai 44.51% <50.00%> (-0.09%) ⬇️
llmobs-vertex-ai 40.37% <50.00%> (-0.17%) ⬇️
platform-core 29.71% <ø> (ø)
platform-esbuild 32.89% <ø> (ø)
platform-instrumentations-misc 40.53% <ø> (ø)
platform-shimmer 36.14% <ø> (ø)
platform-unit-guardrails 31.27% <ø> (ø)
plugins-azure-event-hubs 24.02% <ø> (ø)
plugins-azure-service-bus 23.42% <ø> (ø)
plugins-bullmq 43.78% <50.00%> (-0.12%) ⬇️
plugins-cassandra 38.08% <50.00%> (-0.10%) ⬇️
plugins-cookie 25.08% <ø> (ø)
plugins-cookie-parser 24.87% <ø> (ø)
plugins-crypto 24.72% <ø> (ø)
plugins-dd-trace-api 38.49% <50.00%> (-0.11%) ⬇️
plugins-express-mongo-sanitize 25.04% <ø> (ø)
plugins-express-session 24.83% <ø> (ø)
plugins-fastify 42.58% <50.00%> (-0.10%) ⬇️
plugins-fetch 38.64% <50.00%> (-0.10%) ⬇️
plugins-fs 38.74% <50.00%> (-0.11%) ⬇️
plugins-generic-pool 24.06% <ø> (ø)
plugins-google-cloud-pubsub 45.79% <50.00%> (-0.09%) ⬇️
plugins-grpc 41.33% <50.00%> (-0.10%) ⬇️
plugins-handlebars 25.08% <ø> (ø)
plugins-hapi 40.49% <50.00%> (-0.10%) ⬇️
plugins-hono 40.75% <50.00%> (-0.10%) ⬇️
plugins-ioredis 38.54% <50.00%> (-0.11%) ⬇️
plugins-knex 24.80% <ø> (ø)
plugins-ldapjs 22.61% <ø> (ø)
plugins-light-my-request 24.48% <ø> (ø)
plugins-limitd-client 32.62% <50.00%> (-0.11%) ⬇️
plugins-lodash 24.13% <ø> (ø)
plugins-mariadb 39.67% <50.00%> (-0.10%) ⬇️
plugins-memcached 38.27% <50.00%> (-0.11%) ⬇️
plugins-microgateway-core 39.50% <50.00%> (-0.10%) ⬇️
plugins-moleculer 40.88% <50.00%> (-0.10%) ⬇️
plugins-mongodb 39.59% <50.00%> (-0.10%) ⬇️
plugins-mongodb-core 39.19% <50.00%> (-0.10%) ⬇️
plugins-mongoose 39.22% <50.00%> (-0.10%) ⬇️
plugins-multer 24.83% <ø> (ø)
plugins-mysql 39.30% <50.00%> (-0.14%) ⬇️
plugins-mysql2 39.37% <50.00%> (-0.10%) ⬇️
plugins-node-serialize 25.12% <ø> (ø)
plugins-opensearch 37.91% <50.00%> (-0.10%) ⬇️
plugins-passport-http 24.91% <ø> (ø)
plugins-postgres 35.83% <50.00%> (-0.09%) ⬇️
plugins-process 24.72% <ø> (ø)
plugins-pug 25.08% <ø> (ø)
plugins-redis 39.02% <50.00%> (-0.11%) ⬇️
plugins-router 43.36% <50.00%> (-0.10%) ⬇️
plugins-sequelize 23.66% <ø> (ø)
plugins-test-and-upstream-amqp10 38.46% <50.00%> (-0.26%) ⬇️
plugins-test-and-upstream-amqplib 43.81% <50.00%> (-0.25%) ⬇️
plugins-test-and-upstream-apollo 39.33% <50.00%> (-0.09%) ⬇️
plugins-test-and-upstream-avsc 38.88% <50.00%> (-0.11%) ⬇️
plugins-test-and-upstream-bunyan 33.93% <50.00%> (-0.11%) ⬇️
plugins-test-and-upstream-connect 41.17% <50.00%> (-0.10%) ⬇️
plugins-test-and-upstream-graphql 40.29% <50.00%> (-0.10%) ⬇️
plugins-test-and-upstream-koa 40.73% <50.00%> (-0.10%) ⬇️
plugins-test-and-upstream-protobufjs 39.11% <50.00%> (-0.11%) ⬇️
plugins-test-and-upstream-rhea 44.25% <50.00%> (-0.10%) ⬇️
plugins-undici 39.43% <50.00%> (-0.10%) ⬇️
plugins-url 24.72% <ø> (ø)
plugins-valkey 38.19% <50.00%> (-0.11%) ⬇️
plugins-vm 24.72% <ø> (ø)
plugins-winston 34.31% <50.00%> (-0.10%) ⬇️
plugins-ws 42.29% <50.00%> (-0.10%) ⬇️
profiling-macos 40.04% <50.00%> (-0.10%) ⬇️
profiling-ubuntu 40.17% <50.00%> (-0.48%) ⬇️
profiling-windows 41.40% <50.00%> (-0.10%) ⬇️
serverless-azure-functions-client 23.75% <ø> (ø)
serverless-azure-functions-eventhubs 23.75% <ø> (ø)
serverless-azure-functions-servicebus 23.75% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-datadog-prod-us1

This comment has been minimized.

@bm1549 bm1549 force-pushed the brian.marks/startup-log-stderr-only branch from 93581cf to 0979126 Compare February 12, 2026 01:59
@bm1549 bm1549 added AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos semver-minor and removed semver-patch labels Feb 12, 2026
Changed startup logs to output to stderr (via console.warn) instead of
stdout (via console.info), following Unix conventions and aligning with
other Datadog language tracers.

This is a minimal change that only swaps the output stream - no changes
to timing or function structure.

Changes:
- Changed startupLog() to use warn() instead of info() for stderr output
- Updated all tests to expect console.warn instead of console.info

Related to #7470 (which was reverted in #7478 due to regression from
immediate emission timing change). This PR includes only the stderr
output change without any timing modifications.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@bm1549 bm1549 force-pushed the brian.marks/startup-log-stderr-only branch from 0979126 to 4c13de7 Compare February 12, 2026 02:03
@bm1549 bm1549 requested a review from rochdev February 12, 2026 02:04
@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Feb 12, 2026

Benchmarks

Benchmark execution time: 2026-02-12 02:11:05

Comparing candidate commit 4c13de7 in PR branch brian.marks/startup-log-stderr-only with baseline commit 5de82d7 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 232 metrics, 28 unstable metrics.

Copy link
Copy Markdown
Member

@rochdev rochdev left a comment

Choose a reason for hiding this comment

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

Worth noting that his will only send to stderr by default. When a custom logger is configured, it will go to wherever that logger is configured to send its logs, but I'm assuming this is intended.

LGTM!

@bm1549 bm1549 merged commit e130d50 into master Feb 12, 2026
791 checks passed
@bm1549 bm1549 deleted the brian.marks/startup-log-stderr-only branch February 12, 2026 13:38
dd-octo-sts Bot pushed a commit that referenced this pull request Feb 13, 2026
Changed startup logs to output to stderr (via console.warn) instead of
stdout (via console.info), following Unix conventions and aligning with
other Datadog language tracers.

This is a minimal change that only swaps the output stream - no changes
to timing or function structure.

Changes:
- Changed startupLog() to use warn() instead of info() for stderr output
- Updated all tests to expect console.warn instead of console.info

Related to #7470 (which was reverted in #7478 due to regression from
immediate emission timing change). This PR includes only the stderr
output change without any timing modifications.

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Feb 13, 2026
juan-fernandez pushed a commit that referenced this pull request Feb 18, 2026
Changed startup logs to output to stderr (via console.warn) instead of
stdout (via console.info), following Unix conventions and aligning with
other Datadog language tracers.

This is a minimal change that only swaps the output stream - no changes
to timing or function structure.

Changes:
- Changed startupLog() to use warn() instead of info() for stderr output
- Updated all tests to expect console.warn instead of console.info

Related to #7470 (which was reverted in #7478 due to regression from
immediate emission timing change). This PR includes only the stderr
output change without any timing modifications.

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos semver-minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants