Skip to content

ConsoleLogger not active in the REPL #52075

Closed
@fredrikekre

Description

@fredrikekre

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.

Metadata

Metadata

Assignees

Labels

REPLJulia's REPL (Read Eval Print Loop)loggingThe logging framework

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions