JuliaGPU / JuliaGPU/GPUCompiler.jl

`@safe_debug` does not always work well with `LoggingExtras.jl`

Open
#723 4 comments 0 reactions 0 assignees View on GitHub
upstream
Dominant language
Julia
Stars
187
Forks
68
Avg merge
1d 12h
Merged PRs (30d)
28

Description

I use [LoggingExtras.jl](https://github.com/JuliaLogging/LoggingExtras.jl) for fine-grained logging control. In the following instance, it seems it does not play well with `GPUCompiler.jl`'s [`@safe_debug`](https://github.com/JuliaGPU/GPUCompiler.jl/blob/master/src/utils.jl#L49-L84):

```julia
# julia
# ]activate --temp
# ] add GPUCompiler, LoggingExtras
using GPUCompiler, Logging, LoggingExtras

# Define a custom filter logger
console_logger = Logging.ConsoleLogger(stdout, Logging.Debug) # deliberately set to debug
info_logger = LoggingExtras.EarlyFilteredLogger(log -> log.level >= Logging.Info, console_logger) # here, I filter out anything below Info
global_logger(info_logger)

# in Julia REPL, test some logging levels:
julia> @info "hi"
[ Info: hi

julia> @debug "hi" # no output

julia> GPUCompiler.@safe_debug "hi"
┌ Debug: hi
└ @ Main REPL[50]:1

```

The example above is a bit contrived because I obviously could achieve this using `Logging.ConsoleLogger(stdout)`. In my actual code, I am using `LoggingExtras.TeeLogger` to write to file and stdout simultaneously, e.g.:
```julia
logger = LoggingExtras.TeeLogger((
LoggingExtras.FileLogger("info.log"), # if I comment out this line, then @safe_debug, below, doesn't print
Logging.ConsoleLogger(stdout)
))
global_logger(logger)

julia> GPUCompiler.@safe_debug "hi"
┌ Debug: hi
└ @ Main REPL[74]:1

```

---
Julia Version 1.11.5, GPUCompiler v1.6.1, LoggingExtras v1.1.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with GPUCompiler.jl's src/utils.jl lines 49-84 and reproduce the issue using the LoggingExtras.EarlyFilteredLogger and TeeLogger examples in the report. Compare @safe_debug with Julia's @debug behavior, then verify that debug messages follow the configured logger filtering while preserving the demonstrated logging setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.