-
Notifications
You must be signed in to change notification settings - Fork 257
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
stderr_stream to file not work #1149
Comments
Hi @syncupasia. I was able to reproduce this on my machine and I think the issue is related to your script. If you try running My guess would be that your script outputs to the different output. Please try changing |
Hi I actually tried stdout_stream first but it's the same where it just created empty log file. I think the issue is I want to log unexpected fatal error. If I do try and catch exception then I can write something to stdout. But in this case I want to log any php fatal error so I tried stderr_stream and thought any fatal error will be in the stderr_stream.filename? |
Than the only thing left is for you to check how you handle fatal errors. As far as I understand, fatal errors cause programs to exit, so you have to catch them in a special way. Unfortunately handling of fatal errors in php is out of circus' scope, I don't have any other suggestions. Logging to file works as expected from what I see. |
Hi @biozz , I think I'm experiencing the same issue as @syncupasia , but in this case when using the API? I can reproduce it by running this snippet: from circus.watcher import Watcher
import time
stdoutcfg = {
"class": "circus.stream.FileStream",
"filename": f"/home/user/watchertest.log",
"max_bytes": 52428800,
"backup_count": 5
}
stderrcfg = {
"class": "circus.stream.FileStream",
"filename": f"/home/user/watchertest.err",
"max_bytes": 52428800,
"backup_count": 5
}
w = Watcher(
name='watchertest',
cmd='python3',
args='/home/user/printer.py',
stdout_stream=stdoutcfg,
stderr_stream=stderrcfg,
stop_children=True
)
print(w.status())
w.start()
print(w.status())
print(w.info())
time.sleep(10)
print(w.status())
print(w.info())
w.stop()
print(w.status())
print(w.info()) The "printer.py" is just a script that prints to both stdout and stderr: import sys
import time
while True:
print("hi - stdout", file=sys.stdout, flush=True)
print("hi - stderr", file=sys.stderr, flush=True)
time.sleep(0.5) What happens is that the watchertest.log and .err files are created but remain empty (0 bytes). Also, and not sure if relevant, the This is reproducible in both Circus 0.16.1 and in 0.17.1 |
Hi I've the following config in circus.ini and I have a line in the php script that will result a fatal error during execution but it just created the file and it's empty. What's the issue or anything I set up wrong? I did ps aux command I saw the php script did restart with a new time so it failed with fatal error and started again but just empty log.
[watcher:test]
cmd=/home/php/test.php
numprocesses=1
stderr_stream.class = FileStream
stderr_stream.filename = /tmp/test.err
stderr_stream.refresh_time = 0.3
stderr_stream.max_bytes = 1073741824
stderr_stream.backup_count = 5
The text was updated successfully, but these errors were encountered: