Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different order of message when redirecting to log file #230

Open
szcf-weiya opened this issue Feb 14, 2022 · 0 comments
Open

Different order of message when redirecting to log file #230

szcf-weiya opened this issue Feb 14, 2022 · 0 comments

Comments

@szcf-weiya
Copy link

Suppose I have the following simple script

# file test.jl
using ProgressMeter

for j = 1:3
    println("j = $j")
    @showprogress for i = 1:10
        sleep(1)
    end
end

then I run it from the command line. The progress bar and the println message displayed in the expected order

$ julia test.jl
j = 1
Progress: 100%|█████████████████████████████████████████████████████████| Time: 0:00:10
j = 2
Progress: 100%|█████████████████████████████████████████████████████████| Time: 0:00:10
j = 3
Progress: 100%|█████████████████████████████████████████████████████████| Time: 0:00:10

But if I redirect it to a log file,

$ julia test.jl &> test.log

the log file would postpone the println message when I checked it with tail -f test.log, and they are printed only after the progress bar has been finished. The resulting log file is

Progress: 100%|█████████████████████████████████████████| Time: 0:00:10
Progress: 100%|█████████████████████████████████████████| Time: 0:00:10
Progress: 100%|█████████████████████████████████████████| Time: 0:00:10
j = 1
j = 2
j = 3

I am wondering whether it is possible to write the message into files in order. I am not sure if this is related to the package itself, or the mechanism of redirection, so just try to ask here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant