-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
How do I print accesslog to STDOUT? #1184
Comments
The relevant line is here: https://github.com/benoitc/gunicorn/blame/master/gunicorn/glogging.py#L335 |
Another but less flexible solution: The console handler already prints to |
I'm confused. Doesn't the StreamHandler already log on sys.stdout? |
No, the default value is |
OK I understand now. Originally we were printing logs to stdout. IMO the access log should default to STDOUT. Thoughts? |
@benoitc 👍 Access log on stdout |
any updates on this request? |
@benoitc I am not sure this commit addresses this issue. Let us say I run, In https://github.com/benoitc/gunicorn/blob/master/gunicorn/glogging.py#L302 without any command line arguments |
by default access log is disabled if this is what you mean? |
@benoitc Yes. The discussion above seems to indicate that access logs will go to stdout and error logs to stderr. However, it looks like access logging is disabled by default. BTW, with Python 2.7 I used to be able to do Line 498 in f722a6e
|
👍 @suriya I think I'm looking for the same behavior you are -- I'd like to run EDIT: To clarify, this appears to just be a problem with Python3. Using python3.5.1, passing |
Yes, it looks like access logging is disabled by default. |
@huoxy More than what the default is, I think the issue is more that there is no simple way to write access logs to standard output. |
@huoxy ˋ--access-logfile=-` should do the trick. let me k'ow if not.
|
also it is probably a doc issue. but access log must be printed to stdout
|
logging.StreamHandler deault to sys.stderr, so make sure access log are printed to stdout when choosing "-" by forcing the stream. Note: access logs were printed to stdout by default when using the config file. fix #1184
according to this: default logger is |
Also, the solution I would suggest, is to create a symbolic link for the log files to
|
I just moved to gunicorn 19.7.0 released last week. Unfortunately, I still can't get the access log written to anything other than stderr. I've tried running gunicorn with no options and also with all permutations of including/not including "--access-logfile=- --error-logfile=- --log-level=DEBUG". Am I missing something basic about gunicorn's logging? Is something from my environment or from Django possibly bleeding over and causing this problem? |
With the application file myapp.py, I tried the following.
I can confirm that the access log output goes to |
I'm on Python 2.7.14. (Somehow missed the quick reply months ago.) |
You can also use |
logging.StreamHandler deault to sys.stderr, so make sure access log are printed to stdout when choosing "-" by forcing the stream. Note: access logs were printed to stdout by default when using the config file. fix benoitc#1184
Hi,
http://docs.gunicorn.org/en/stable/settings.html#accesslog is telling me
'-'
will output to stderr but we prefer STDOUT for logging purposes. Is there a way to do that?Thanks!
The text was updated successfully, but these errors were encountered: