'How can I enable debug output?
I tried printing something to the debug log, but I see no output:
julia> @debug "foo"
How can I enable debug output?
Solution 1:[1]
Use the JULIA_DEBUG environment variable to set debug output.
Set the value to the name of the module for which you want to enable debug logging:
julia> ENV["JULIA_DEBUG"] = Base
For the case of @debug calls in the REPL, set the module to Main:
julia> ENV["JULIA_DEBUG"] = Main
Main
julia> @debug "foo"
? Debug: foo
? @ Main REPL[6]:1
The special all value will enable debug logging for all modules:
julia> ENV["JULIA_DEBUG"] = "all"
If want to enable debugging during startup, you can set it through the shell:
$ JULIA_DEBUG=all julia
Solution 2:[2]
The other answer didn't work for me, so I did this which changes the global message filter level:
using Logging
disable_logging(Logging.Debug) # disable debug, info only
disable_logging(Logging.Debug-2000) # enable debug
see https://docs.julialang.org/en/v1/stdlib/Logging/#Logging.disable_logging
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | davidvarela_us |
| Solution 2 | Spcogg the second |
