Open ranocha opened 4 years ago
In GitLab by @sloede on Mar 18, 2020, 12:56
changed the description
In GitLab by @sloede on Mar 24, 2020, 09:10
changed the description
In GitLab by @sloede on May 13, 2020, 09:30
changed the description
I am not sure what the proper way to implement logging in Trixi is. Obviously every println(...)
will need to be replaced by an @info
or @debug
. But how should we control the logging level?
Should we explicitly provide a logger using
with_logger(logger) do
[...]
end
somewhere in Trixi.run
?
Or should we rather use the default (global) logger and control logging levels with the environment variable?
It would be nice to get this to be able to use https://github.com/JuliaLogging/LoggingExtras.jl
A tee-like option may be Base.BufferStream
, see https://discourse.julialang.org/t/write-to-file-and-stdout/35042/13
Out of curiosity, what would this enable?
On Thu, May 23, 2024 at 12:36 PM Hendrik Ranocha @.***> wrote:
A tee-like option may be Base.BufferStream, see https://discourse.julialang.org/t/write-to-file-and-stdout/35042/13
— Reply to this email directly, view it on GitHub https://github.com/trixi-framework/Trixi.jl/issues/4#issuecomment-2127710073, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI2HUCUCPMS3ZU53WV6473ZDYSK7AVCNFSM4QDMFPLKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJSG43TCMBQG4ZQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Printing the output to a file and the screen - something several people have asked on Slack
In GitLab by @sloede on Mar 14, 2020, 12:25
Store all regular output plus additional debug information in a log file such that it can be recovered later, e.g., in
out/trixi_YYYMMDDHHmmss.log
The logging mechanism of Julia (https://docs.julialang.org/en/v1/stdlib/Logging/) should be used. The idea is the following (roughly as discussed with Gregor):
@info
and@debug
@info
is the normal runtime output@debug
is additional output that can help with debugging@info
goes tostdout
while@debug
is not evaluated at all.log=True
orlog=<filename>
is provided torun()
, all@info
messages go additionally toout/trixi.log
orout/<filename>.log
debug=True
is provided torun()
(orENV["JULIA_DEBUG"]
is set appropriately), all@debug
messages are shown atstdout
as well. In combination withlog=True/<filename>
, however, debug messages will only be shown in the log file.It might be interesting to enable other default output if logging-to-file is enabled, e.g., to copy the parameters file used to the beginning of the log file, or some information on when and where and with which command line arguments trixi was started.
Potential use cases where it might be interesting to have a permanent log: