Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backtraces in logs are bad unless Logging is loaded #53312

Closed
KristofferC opened this issue Feb 13, 2024 · 3 comments
Closed

Backtraces in logs are bad unless Logging is loaded #53312

KristofferC opened this issue Feb 13, 2024 · 3 comments
Labels
excision Removal of code from Base or the repository logging The logging framework
Milestone

Comments

@KristofferC
Copy link
Member

With REPL not being in the sysimage we have the following:

# 1.10
❯ julia -e '@warn "beep" exception=(ErrorException("foo"), backtrace())'
┌ Warning: beep
│   exception =
│    foo
│    Stacktrace:
│     [1] backtrace()
│       @ Base ./error.jl:114
│     [2] macro expansion
│       @ logging.jl:373 [inlined]
│     [3] top-level scope
│       @ none:382
│     [4] eval
│       @ Core ./boot.jl:385 [inlined]
│     [5] exec_options(opts::Base.JLOptions)
│       @ Base ./client.jl:291
│     [6] _start()
│       @ Base ./client.jl:552
└ @ Main none:1

#master
❯ ./julia -e '@warn "beep" exception=(ErrorException("foo"), backtrace())'
┌ Warning: beep
│   exception = (ErrorException("foo"), Union{Ptr{Nothing}, Base.InterpreterIP}[Ptr{Nothing} @0x0000000125a4a3c9, Ptr{Nothing} @0x000000010d67452d, Ptr{Nothing} @0x000000010d673e0d, Ptr{Nothing} @0x000000010d672b25, Ptr{Nothing} @0x000000010d672dff, Ptr{Nothing} @0x000000010d6731a8, Base.InterpreterIP in top-level CodeInfo for Main at statement 50, Ptr{Nothing} @0x000000010d68e1a6, Ptr{Nothing} @0x000000010d68df04, Ptr{Nothing} @0x000000010d68ed6f, Ptr{Nothing} @0x0000000125e81271, Ptr{Nothing} @0x00000001258cabca, Ptr{Nothing} @0x0000000125cf9e59, Ptr{Nothing} @0x000000010d6c2f35, Ptr{Nothing} @0x000000010d6c2e59])
└ @ Main none:1

It doesn't really make sense to me why the REPL should be required to print things nicely to stdout. Those two things seem like orthogonal concepts.

@KristofferC KristofferC added excision Removal of code from Base or the repository logging The logging framework labels Feb 13, 2024
@KristofferC KristofferC added this to the 1.11 milestone Feb 13, 2024
@vtjnash
Copy link
Member

vtjnash commented Feb 13, 2024

It isn't REPL, but the broken state of logging if using Logging isn't present:

$ ./julia -e '@warn "beep" exception=(ErrorException("foo"), backtrace())'
┌ Warning: beep
│   exception = (ErrorException("foo"), Union{Ptr{Nothing}, Base.InterpreterIP}[Ptr{Nothing} @0x00007f5726afd3a0, Ptr{Nothing} @0x00007f573ad32c6b, Ptr{Nothing} @0x00007f573ad56b9b, Ptr{Nothing} @0x00007f573ad563da, Ptr{Nothing} @0x00007f573ad576b5, Ptr{Nothing} @0x00007f573ad57d78, Ptr{Nothing} @0x00007f573ad59575, Base.InterpreterIP in top-level CodeInfo for Main at statement 50, Ptr{Nothing} @0x00007f573ad7d7a2, Ptr{Nothing} @0x00007f573ad7e160, Ptr{Nothing} @0x00007f573ad80202, Ptr{Nothing} @0x00007f5726c752c4, Ptr{Nothing} @0x00007f5726d95da8, Ptr{Nothing} @0x00007f5727157b90, Ptr{Nothing} @0x00007f573ad32c6b, Ptr{Nothing} @0x00007f573adbeb15, Ptr{Nothing} @0x00007f573adbf631, Ptr{Nothing} @0x0000562c9300c08c, Ptr{Nothing} @0x00007f573b9efd8f, Ptr{Nothing} @0x00007f573b9efe3f, Ptr{Nothing} @0x0000562c9300c0c4])
└ @ Main none:1

$ ./julia -e 'using Logging' -e '@warn "beep" exception=(ErrorException("foo"), backtrace())'
┌ Warning: beep
│   exception =
│    foo
│    Stacktrace:
│     [1] macro expansion
│       @ logging.jl:377 [inlined]
│     [2] top-level scope
│       @ none:386
│     [3] eval
│       @ ./boot.jl:428 [inlined]
│     [4] exec_options(opts::Base.JLOptions)
│       @ Base ./client.jl:291
│     [5] _start()
│       @ Base ./client.jl:525
└ @ Main none:1

@vtjnash vtjnash changed the title Backtraces in logs are bad unless REPL is loaded Backtraces in logs are bad unless Logging is loaded Feb 13, 2024
@KristofferC
Copy link
Member Author

KristofferC commented Feb 13, 2024

Ah,

function __init__()
global_logger(ConsoleLogger())
end

So, move ConsoleLogger to Base? What's the point of the Logging stdlib anyway?

@IanButterworth
Copy link
Member

Dup of #51493 #52075 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
excision Removal of code from Base or the repository logging The logging framework
Projects
None yet
Development

No branches or pull requests

3 participants