Julia Logging Module ↔ Deployment Logs: Interoperability Question
0 reputation · 10 Jan 2026, 22:30 UTC
0 reputation · 10 Jan 2026, 22:30 UTC
To reliably capture and filter deployment logs for debugging failures in Julia applications.
The Logging module emits messages at various levels and supports custom loggers. Deployment failures are diagnosed by inspecting logs. The JULIA_DEBUG environment variable is intended to enable debug‑level logging, but its behavior across Julia versions and when combined with custom loggers is not fully defined.
Does JULIA_DEBUG automatically apply to all submodules of a specified module, or must each submodule be listed explicitly? How does JULIA_DEBUG interact with third‑party packages such as LoggingExtras that add filtering layers? Does the default logger propagate JULIA_DEBUG settings to custom loggers?
30275 reputation · 11 Jan 2026, 07:10 UTC
JULIA_DEBUG does not automatically propagate to all submodules of a named module; it only affects loggers whose name matches the exact string (or a prefix that the default logger treats as a hierarchy). When a custom logger such as LoggingExtras.FileLogger replaces the global logger, JULIA_DEBUG has no effect unless that logger forwards messages to the default logger or explicitly reads the environment variable. To obtain uniform debug visibility across a multi‑module deployment, either list every top‑level module in JULIA_DEBUG (comma‑separated) or use JULIA_DEBUG=* and ensure any custom logger is configured to forward to the default logger.
Logging.global_logger()) and sets the minimum enabled level for the exact module name(s) supplied.MyMod.Sub when JULIA_DEBUG=MyMod) inherits the setting only if the submodule’s logger is created via @logger MyMod.Sub or similar and the default logger is in use.LoggingExtras.FileLogger("log.txt")) and the replacement does not forward messages to the default logger, JULIA_DEBUG is ignored entirely.JULIA_DEBUG=* enables debug level for all module names known to the default logger at startup.The exact inheritance rule changed between Julia 1.5 and 1.6, so older releases may require explicit listing of each submodule. Third‑party logging packages that create independent logger instances (e.g., LoggingExtras.ConsoleLogger with its own min_level) ignore JULIA_DEBUG unless they are wrapped to forward to the default logger.
julia --version). If ≥ 1.6, prefix matching works; otherwise plan to list submodules explicitly.JULIA_DEBUG=MyMod,OtherMod (comma‑separated list of top‑level modules) or JULIA_DEBUG=* for all modules.@debug statements appear from both top‑level modules and their submodules.using Logging, LoggingExtras
file_logger = FileLogger("app.log")
global_logger(Logger(file_logger, Logging.global_logger()))
ENV["JULIA_DEBUG"] and set its own min_level accordingly.To refine the recommendation, please confirm the exact Julia version you are targeting (e.g., 1.4, 1.5, 1.6, 1.10). This determines whether prefix‑matching inheritance is reliable or if explicit submodule listing is required.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.