Skip to content

console.trace() goes to stdout instead of stderr #19952

@190n

Description

@190n

What version of Bun is running?

1.2.15-canary.63+df017990a

What platform is your computer?

Darwin 24.4.0 arm64 arm

What steps can reproduce the bug?

Run trace.js and observe what is printed to stdout and what to stderr:

console.trace("hello");

What is the expected behavior?

Trace is printed to stderr (observed because redirecting stdout has no effect):

$ node trace.js >/dev/null
Trace: hello
    at Object.<anonymous> (/Users/ben/code/bun/workers/trace.js:1:9)
    at Module._compile (node:internal/modules/cjs/loader:1723:14)
    at Object..js (node:internal/modules/cjs/loader:1888:10)
    at Module.load (node:internal/modules/cjs/loader:1458:32)
    at Function._load (node:internal/modules/cjs/loader:1275:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:234:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:151:5)
    at node:internal/main/run_main_module:33:47

What do you see instead?

Trace is printed to stdout:

$ bun trace.js >/dev/null
$ # no output

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconfirmed bugWe can reproduce this issueconsoleRelated to console apisgood first issueSomething that would be good for new contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions