-
Notifications
You must be signed in to change notification settings - Fork 27
Subprocess log file setting issue #52
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
Comments
Same problem +1 use |
What version of Python were you using when you did this test? I have noticed that version 3.10.11-amd64 is experiencing several instability issues. |
Python 3.8.5-amd64 OS: Windows 11 |
I did a more detailed test, and when Flask Debug mode is started, the print log will be output the next time the service is restarted (Debug mode).
@app.route("/")
def index():
print(111111111)
print("test中文test")
return "ok"
if __name__ == "__main__":
app.run("0.0.0.0", 5001, debug=True) Log out after sending two requests:
@app.route("/")
def index():
print(111111111)
print("test中文test")
print(222222222)
return "ok" Log out: You can see that the log has been refreshed. But I have same issue with #49 (log missed 中文) and it is correct for me to go back to version 4.5.0.
Complete configuration file: [supervisord]
nodaemon=false
[inet_http_server]
port=*:9001
[supervisorctl]
[program:app-win1]
command=D:\\workspace\\xxx\\xxx-server\\venv\\Scripts\\python.exe D:\\workspace\\xxx\\xxx-server\\src\\wsgi.py
autostart=true
autorestart=true
# 将stderr的日志写入stdout日志文件中
redirect_stderr=true
stdout_logfile=D:\workspace\xxx\xxx-server\logs\app1.log
stdout_logfile_maxbytes=10MB
stdout_logfile_backups=5
# 杀死进程组包括子进程
stopasgroup=true
killasgroup=true |
What encoding is used in the script to print Does configuring python encoding before initializing it solve the problem?
|
@alexsilva Thanks, it's worked. [supervisord]
nodaemon=false
environment=PYTHONIOENCODING="utf8"
... Is there a solution to the problem of delayed printing of logs? |
I got it.
[supervisord]
nodaemon=false
environment=PYTHONIOENCODING=utf8,PYTHONUNBUFFERED=1
... |
Recently I introduced a new concept and it serves to control the time that the process is idle. The more processing there is, the more the sleep time tends to zero. This will help with log processing as well. |
This is my configuration file
[program:xxxx]
command=cmd.exe xxxxx
autostart=true
autorestart=true
startretries=3
stdout_logfile=NONE
stderr_logfile=xx/xxx.log
I set the standard output log to empty and prevent it from entering relevant logs. But how can there be [info] level logs in the error log file?
My loglevel=error
By the way, if the sub process frequently outputs logs, will it affect the performance of superviosr and cause blocking? This question is very important. Please answer it. Thank you
The text was updated successfully, but these errors were encountered: