# Redirecting stdout only redirects part of the output

**URL:** <https://discourse.julialang.org/t/redirecting-stdout-only-redirects-part-of-the-output/127379>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [March 26, 2025, 12:04pm UTC](https://discourse.julialang.org/t/redirecting-stdout-only-redirects-part-of-the-output/127379 "2025-03-26T12:04:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarcMiranda](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@MarcMiranda](https://discourse.julialang.org/u/MarcMiranda)\
**Post date:** [March 26, 2025, 12:04pm UTC](https://discourse.julialang.org/t/redirecting-stdout-only-redirects-part-of-the-output/127379/1 "2025-03-26T12:04:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 26, 2025, 12:07pm UTC](https://discourse.julialang.org/t/redirecting-stdout-only-redirects-part-of-the-output/127379/2 "2025-03-26T12:07:48Z")

</div>

See: [Redirect stdout, stderr to string/stream C++ (embedded) - #4 by stevengj](https://discourse.julialang.org/t/redirect-stdout-stderr-to-string-stream-c-embedded/124210/4)

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.

---

<div class="post-metadata">

**Author:** ![MarcMiranda](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@MarcMiranda](https://discourse.julialang.org/u/MarcMiranda)\
**Post date:** [March 26, 2025, 12:28pm UTC](https://discourse.julialang.org/t/redirecting-stdout-only-redirects-part-of-the-output/127379/3 "2025-03-26T12:28:18Z")

</div>

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](https://github.com/variPEPS/VariPEPS.jl/tree/main). 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

---

<div class="post-metadata">

**Author:** ![MarcMiranda](https://avatars.discourse-cdn.com/v4/letter/m/7feea3/32.png) [@MarcMiranda](https://discourse.julialang.org/u/MarcMiranda)\
**Post date:** [March 26, 2025, 12:35pm UTC](https://discourse.julialang.org/t/redirecting-stdout-only-redirects-part-of-the-output/127379/4 "2025-03-26T12:35:03Z")

</div>

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
