Good morning, I am using redirect_stdout to redirect the ouput to a file “log.log”. However, only the part of printed statements using println() are being printed. However, a library I am importing uses display() and the messages are not being redirected to “log.log”, although they have also ceased to appear in the console. What is wrong?
Thank you
See: Redirect stdout, stderr to string/stream C++ (embedded) - #4 by stevengj
PS. What library are you importing that does this? Calling display
, as opposed to e.g. show(stdout, "text/plain", x)
, might be a bug. How display
shows an object depends on the environment.
1 Like
Good morning, thank you for your fast response. I was not expecting that. I have tried to add the lines
tDisp = TextDisplay(log_out)
pushdisplay(tDisp)
to try to redirect the display output to the logfile. However, it seems not to be working. The library using display is VariPEPS.jl. I believe now there is more output. However now this made me realize that I am not missing output from OptimKit.jl that uses sprintf. I am trying to see how to also get that output to the file
Hello,
the problem was that OptimKit.jl was using his own logging system, adding the line global_logger(SimpleLogger(log_out)) is now functioning properly.
Thank you Steven for your help
1 Like