# Logging issue with Juno and Revise

**URL:** <https://discourse.julialang.org/t/logging-issue-with-juno-and-revise/26280>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 12, 2019, 8:54am UTC](https://discourse.julialang.org/t/logging-issue-with-juno-and-revise/26280 "2019-07-12T08:54:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cserteGT3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csertegt3/32/8283_2.png) [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Post date:** [July 12, 2019, 8:54am UTC](https://discourse.julialang.org/t/logging-issue-with-juno-and-revise/26280/1 "2019-07-12T08:54:37Z")

</div>

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`:

```julia
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
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
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
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
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
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:

```julia
# 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?

---

<div class="post-metadata">

**Author:** ![cserteGT3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csertegt3/32/8283_2.png) [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Post date:** [July 15, 2019, 12:39pm UTC](https://discourse.julialang.org/t/logging-issue-with-juno-and-revise/26280/2 "2019-07-15T12:39:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [July 15, 2019, 12:48pm UTC](https://discourse.julialang.org/t/logging-issue-with-juno-and-revise/26280/3 "2019-07-15T12:48:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cserteGT3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/csertegt3/32/8283_2.png) [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Post date:** [July 15, 2019, 1:07pm UTC](https://discourse.julialang.org/t/logging-issue-with-juno-and-revise/26280/4 "2019-07-15T13:07:34Z")

</div>

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