# How to use @debug

**URL:** <https://discourse.julialang.org/t/how-to-use-debug/25237>\
**Category:** General Usage\
**Created:** [June 13, 2019, 10:06am UTC](https://discourse.julialang.org/t/how-to-use-debug/25237 "2019-06-13T10:06:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [June 13, 2019, 10:06am UTC](https://discourse.julialang.org/t/how-to-use-debug/25237/1 "2019-06-13T10:06:30Z")

</div>

```julia
julia> ENV["JULIA_DEBUG"]="all"
"all"

julia> @debug for i=1:6
                  println("haha")
              end
haha
haha
haha
haha
haha
haha
┌ Error: Exception while generating log record in module Main at none:1
│ exception =
│ ArgumentError: `nothing` should not be printed; use `show`, `repr`, or custom output instead.
│ Stacktrace:
│ [1] print(::Base.GenericIOBuffer{Array{UInt8,1}}, ::Nothing) at ./show.jl:566
│ [2] print_to_string(::Nothing) at ./strings/io.jl:122
│ [3] string(::Nothing) at ./strings/io.jl:155
│ [4] #handle_message#2(::Nothing, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Logging.ConsoleLogger, ::Base.CoreLogging.LogLevel, ::Nothing, ::Module, ::String, ::Symbol, ::String, ::Int64) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Logging/src/ConsoleLogger.jl:108
│ [5] handle_message(::Logging.ConsoleLogger, ::Base.CoreLogging.LogLevel, ::Nothing, ::Module, ::String, ::Symbol, ::String, ::Int64) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Logging/src/ConsoleLogger.jl:100
│ [6] #handle_message#1(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Atom.Progress.JunoProgressLogger, ::Base.CoreLogging.LogLevel, ::Nothing, ::Module, ::String, ::Symbol, ::String, ::Int64) at /Users/nanal/.julia/packages/Atom/v2iqN/src/progress.jl:66
│ [7] handle_message(::Atom.Progress.JunoProgressLogger, ::Base.CoreLogging.LogLevel, ::Nothing, ::Module, ::String, ::Symbol, ::String, ::Int64) at /Users/nanal/.julia/packages/Atom/v2iqN/src/progress.jl:32
│ [8] macro expansion at ./none:2 [inlined]
│ [9] top-level scope at ./logging.jl:319
│ [10] eval at ./boot.jl:319 [inlined]
│ [11] repleval(::Module, ::Expr) at /Users/nanal/.julia/packages/Atom/v2iqN/src/repl.jl:139
│ [12] (::getfield(Atom, Symbol("##164#166")){Module})() at /Users/nanal/.julia/packages/Atom/v2iqN/src/repl.jl:161
│ [13] with_logstate(::getfield(Atom, Symbol("##164#166")){Module}, ::Base.CoreLogging.LogState) at ./logging.jl:395
│ [14] with_logger at ./logging.jl:491 [inlined]
│ [15] evalrepl(::Module, ::String) at /Users/nanal/.julia/packages/Atom/v2iqN/src/repl.jl:152
│ [16] top-level scope at /Users/nanal/.julia/packages/Atom/v2iqN/src/repl.jl:194
│ [17] eval(::Module, ::Any) at ./boot.jl:319
│ [18] eval_user_input(::Any, ::REPL.REPLBackend) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:85
│ [19] macro expansion at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:117 [inlined]
│ [20] (::getfield(REPL, Symbol("##28#29")){REPL.REPLBackend})() at ./task.jl:259
└ @ Main none:1

```

Is it strange the above give me an error?
