Logging issue with Juno and Revise

I’ve created a custom logger, which doesn’t show @debug messages with Revise in Juno.
If I include() the source file, it works in the REPL and Juno too. If I includet with Revise, then works in REPL, but not in Juno.
logtest.jl:

module LogT

using Logging
using Logging: default_logcolor

export nosource_debuglogger,
        nosource_infologger,
        sourced_debuglogger,
        sourced_infologger


function nosource_metafmt(level, _module, group, id, file, line)
    color = default_logcolor(level)
    prefix = (level == Logging.Warn ? "Warning" : string(level))*':'
    suffix = ""
    return color, prefix, suffix
end

nosource_debuglogger() = ConsoleLogger(stderr, Logging.Debug, meta_formatter=nosource_metafmt)
nosource_infologger() = ConsoleLogger(stderr, Logging.Info, meta_formatter=nosource_metafmt)
sourced_debuglogger() = ConsoleLogger(stderr, Logging.Debug)
sourced_infologger() = ConsoleLogger(stderr, Logging.Info)

end

“Normal” include in the REPL:

julia> include("logtest.jl"); using .LogT

julia> using Logging

julia> @info "info"
[ Info: info

julia> @debug "debug"

julia> global_logger(nosource_debuglogger())
ConsoleLogger(Base.TTY(Base.Libc.WindowsRawSocket(0x0000000000000298) open, 0 bytes waiting), Info, Logging.default_metafmt, true, 0, Dict{Any,Int64}())

julia> @info "info"
[ Info: info

julia> @debug "debug"
[ Debug: debug

“Normal” include in Juno:

julia> include("logtest.jl"); using .LogT

julia> using Logging

julia> @info "info"
[ Info: info

julia> @debug "debug"

julia> global_logger(nosource_debuglogger())
ConsoleLogger(Base.TTY(Base.Libc.WindowsRawSocket(0x00000000000002a4) open, 0 bytes waiting), Info, Logging.default_metafmt, true, 0, Dict{Any,Int64}())

julia> @info "info"
[ Info: info

julia> @debug "debug"
[ Debug: debug

Revise include in the REPL (in a new session):

julia> using Revise; includet("logtest.jl"); using .LogT

julia> using Logging

julia> @info "info"
[ Info: info

julia> @debug "debug"

julia> global_logger(nosource_debuglogger())
ConsoleLogger(Base.TTY(Base.Libc.WindowsRawSocket(0x00000000000002ac) open, 0 bytes waiting), Info, Logging.default_metafmt, true, 0, Dict{Any,Int64}())

julia> @info "info"
[ Info: info

julia> @debug "debug"
[ Debug: debug

Revise include in Juno (in a new session):

julia> using Revise; includet("logtest.jl"); using .LogT

julia> using Logging

julia> @info "info"
[ Info: info

julia> @debug "debug"

julia> global_logger(nosource_debuglogger())
ConsoleLogger(Base.TTY(Base.Libc.WindowsRawSocket(0x0000000000000298) open, 0 bytes waiting), Info, Logging.default_metafmt, true, 0, Dict{Any,Int64}())

julia> @info "info"
[ Info: info

julia> @debug "debug"

julia> 

As shown above, with Revise in Juno the @debug messages are not shown.

Versions (not relevant packages suppressed):

julia> versioninfo()
Julia Version 1.1.1
Commit 55e36cc308 (2019-05-16 04:10 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, ivybridge)

(v1.1) pkg> st
    Status `C:\Users\cstamas\.julia\environments\v1.1\Project.toml`
  [c52e3926] Atom v0.8.5
  [e5e0dc1b] Juno v0.7.0
  [295af30f] Revise v2.1.6
...

Juno:

# Atom:
Version: 1.36.1
Dev Mode: false
Official Release: true
{
  "http_parser": "2.7.0",
  "node": "8.9.3",
  "v8": "6.1.534.41",
  "uv": "1.15.0",
  "zlib": "1.2.11",
  "ares": "1.10.1-DEV",
  "modules": "57",
  "nghttp2": "1.25.0",
  "openssl": "1.0.2n",
  "electron": "2.0.18",
  "chrome": "61.0.3163.100"
}
# julia-client:
Version: 0.8.10
Config:
{
  "firstBoot": false,
  "juliaOptions": {},
  "uiOptions": {
    "enableMenu": true,
    "enableToolBar": true,
    "usePlotPane": false
  }
}


# ink:
Version: 0.10.11
Config:
undefined


# uber-juno:
Version: 0.2.0
Config:
{
  "disable": true
}


# language-julia:
Version: 0.19.1
Config:
undefined


# language-weave:
Version: 0.6.4
Config:
undefined


# indent-detective:
Version: 0.3.3
Config:
undefined


Could not connect to Julia.

Does anyone have an idea what happens here?

1 Like

@pfitzseb or @tim.holy do you have an idea why this happens? (Sorry if it’s rude to directly mention people.)

Not really – I played around with this a bit and it looks like a Juno bug, but I’m not sure why it happens. Probably some weird interaction with both packages doing weird stuff to hook into the REPL.

1 Like

Thank you! Then I’ll find a workaround for this concrete application. I’ll open an issue just for the record.