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

ConsoleLogger not active in the REPL #52075

Closed
fredrikekre opened this issue Nov 8, 2023 · 3 comments · Fixed by #54428
Closed

ConsoleLogger not active in the REPL #52075

fredrikekre opened this issue Nov 8, 2023 · 3 comments · Fixed by #54428
Assignees
Labels
logging The logging framework stdlib:REPL Julia's REPL (Read Eval Print Loop)
Milestone

Comments

@fredrikekre
Copy link
Member

Logging.__init__ replaces the global logger:

function __init__()
global_logger(ConsoleLogger())
end
Before #51399 this was more or less impossible to notice since Logging.__init__ was run when loading the sysimg. However, now this isn't the case anymore. This means that

  1. The colorless SimpleLogger is used by default in the REPL
  2. using Logging replaces the logger, which might be a logger a user has already configured
julia> @info "Where are my colors?" logtype = typeof(Base.global_logger())
┌ Info: Where are my colors?
│   logtype = Base.CoreLogging.SimpleLogger
└ @ Main REPL[1]:1

julia> using Logging

julia> @info "Thanks for the colors, but you stole my logger..." logtype = typeof(Base.global_logger())
┌ Info: Thanks for the colors, but you stole my logger...
└   logtype = ConsoleLogger

image

Not sure what the best fix is, but probably REPL should depend on Logging and setup the logger while the REPL initializes.

@fredrikekre fredrikekre added stdlib:REPL Julia's REPL (Read Eval Print Loop) logging The logging framework labels Nov 8, 2023
@KristofferC
Copy link
Sponsor Member

Maybe the cause of JuliaLang/JuliaSyntax.jl#375

@KristofferC KristofferC added this to the 1.11 milestone Nov 8, 2023
@IanButterworth
Copy link
Sponsor Member

It's a problem before REPL for startup.jl too #51493

@KristofferC
Copy link
Sponsor Member

I was planning on moving ConsoleLogger to Base to fix this but it depends on StyledStrings now so that's not really possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logging The logging framework stdlib:REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
4 participants