# Set flushing mode for output stream

**URL:** https://discourse.julialang.org/t/set-flushing-mode-for-output-stream/102546
**Category:** General Usage
**Created:** [August 7, 2023, 5:38am UTC](https://discourse.julialang.org/t/set-flushing-mode-for-output-stream/102546 "2023-08-07T05:38:45Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)
#### Post date: [August 8, 2023, 5:53pm UTC](https://discourse.julialang.org/t/set-flushing-mode-for-output-stream/102546/3 "2023-08-08T17:53:46Z")

</div>

I think the best way is to

1. Define default buffering for `stdout` and `stderr`. On Linux, `stdout` is line-buffered and `stderr` is unbuffered (I haven’t verified this, though). I think these are excellent defaults.
2. Give the programmer the ability of setting the buffering behavior of a new stream.
3. Give the programmer the ability of changing the buffering mode of any stream.

I’m afraid I don’t think that flushing in `println()` is the way to go. We expect maximal efficiency when printing into a fully buffered stream, but your redefinition of `println` would degrade the performance.

---

_[View the full topic](https://discourse.julialang.org/t/set-flushing-mode-for-output-stream/102546)._
