You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using logstation on a file that I'm printing to from a Python script, and I'm noticing lines being skipped when the Python print call contains newlines (\n). Was able to reproduce with a small example script, the only config change was specifying the file.
with open('test.log', 'a') as f:
f.write("test line\n")
f.write("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
When watching test.log I get
test line
1
2
4
6
8
10
The text was updated successfully, but these errors were encountered:
Quick update: I have been able to recreate this. Surprisingly, if I put in breakpoints at key points in the app, it behaves as expected. This must be a speed/performance problem. I'll keep digging.
I also thought switching to a polling tailing method (e.g. check the file every 500ms for new log lines) instead of a filesystem alert tailing method (e.g. wait for the filesystem to tell me the log file was written to) would fix it. But it didn't.
Seems to be only happening when lines are written out all at the same time or under a millisecond. I still want to fix this, but it shouldn't affect most people.
jdrews
changed the title
Lines are getting skipped when printing from Python
Lines are getting skipped when printing multiple lines within the same millisecond
Oct 21, 2023
jdrews
changed the title
Lines are getting skipped when printing multiple lines within the same millisecond
Lines are getting skipped when reading multiple lines within the same millisecond
Oct 21, 2023
I'm using logstation on a file that I'm printing to from a Python script, and I'm noticing lines being skipped when the Python print call contains newlines (
\n
). Was able to reproduce with a small example script, the only config change was specifying the file.When watching
test.log
I getThe text was updated successfully, but these errors were encountered: