# Error logging with nginx and uWSGI

**URL:** <https://www.ruby-forum.com/t/error-logging-with-nginx-and-uwsgi/241803>\
**Category:** NGINX\
**Created:** [May 1, 2015, 6:05pm UTC](https://www.ruby-forum.com/t/error-logging-with-nginx-and-uwsgi/241803 "2015-05-01T18:05:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [May 1, 2015, 6:05pm UTC](https://www.ruby-forum.com/t/error-logging-with-nginx-and-uwsgi/241803/1 "2015-05-01T18:05:29Z")

</div>

Prior to now, all the django projects I’ve worked on have used apache  
and WSGI. With those, when an error occurred I went to  
/var/log/httpd/error\_log and details of the error were clearly there.

Now for the first time I am working on a project using nginx and  
uWSGI. Here, the /var/log/nginx/error\_log is always empty. And the  
uWSGI logs have some messages, but nothing about any errors. In this  
setup where would I go to find the errors that  
/var/log/httpd/error\_log logs? Is there some config setting that is  
suppressing the nginx errors?

---

<div class="post-metadata">

**Author:** ![gennosuke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/97f17d/32.png) [@gennosuke](https://www.ruby-forum.com/u/gennosuke)\
**Post date:** [May 3, 2015, 2:19pm UTC](https://www.ruby-forum.com/t/error-logging-with-nginx-and-uwsgi/241803/2 "2015-05-03T14:19:21Z")

</div>

Hello!

On Fri, May 01, 2015 at 12:04:51PM -0400, Larry M. wrote:

> Prior to now, all the django projects I’ve worked on have used apache  
> and WSGI. With those, when an error occurred I went to  
> /var/log/httpd/error\_log and details of the error were clearly there.
> 
> Now for the first time I am working on a project using nginx and  
> uWSGI. Here, the /var/log/nginx/error\_log is always empty. And the  
> uWSGI logs have some messages, but nothing about any errors. In this  
> setup where would I go to find the errors that  
> /var/log/httpd/error\_log logs? Is there some config setting that is  
> suppressing the nginx errors?

The uwsgi protocol doesn’t include an error stream from an  
application to nginx. That is, if you are looking for errors  
generated by your application, you should look into uWSGI logs.

Own nginx logs can be controlled using the error\_log directive,  
see [Core functionality](http://nginx.org/r/error_log). But I suspect it’s not what are  
you looking for, see above.

–  
Maxim D.

> **[nginx](http://nginx.org/)**

---

<div class="post-metadata">

**Author:** ![gennosuke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/97f17d/32.png) [@gennosuke](https://www.ruby-forum.com/u/gennosuke)\
**Post date:** [May 5, 2015, 4:02pm UTC](https://www.ruby-forum.com/t/error-logging-with-nginx-and-uwsgi/241803/3 "2015-05-05T16:02:53Z")

</div>

Hello!

On Tue, May 05, 2015 at 08:08:42AM -0400, Larry M. wrote:

> > > uWSGI. Here, the /var/log/nginx/error\_log is always empty. And the  
> > > see [Core functionality](http://nginx.org/r/error_log). But I suspect it’s not what are  
> > > you looking for, see above.
> 
> When my app has, for example, a syntax error, then yes, that appears  
> in the uWSGI log. But what I was talking about are the HTTP errors  
> like a 500 or a 400. When I get those there’s nothing in the logs.

If an error is returned by your application and/or uWSGI, then its  
reasons are expected to be in your application logs (or the uWSGI  
logs).

If an error is returned by nginx (e.g., because a client sent an  
invalid request and nginx returned 400), then reasons should be in  
nginx error log. Client-related errors, though, are usually  
logged at the “info” level, and won’t be visible in error log by  
default, see [Core functionality](http://nginx.org/r/error_log).

Note well that nginx error logs are highly customizeable, and it  
is possible that you are looking into a wrong file. In  
particular, please note that default error log can be redefined  
during compilation (see “nginx -V” output to find out which one is  
used by default), and can also be redefined on a per-server or a  
per-location basis (check your configs to find out if it’s the  
case).

–  
Maxim D.

> **[nginx](http://nginx.org/)**

---

<div class="post-metadata">

**Author:** ![gennosuke](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/97f17d/32.png) [@gennosuke](https://www.ruby-forum.com/u/gennosuke)\
**Post date:** [May 5, 2015, 2:09pm UTC](https://www.ruby-forum.com/t/error-logging-with-nginx-and-uwsgi/241803/4 "2015-05-05T14:09:33Z")

</div>

On Sun, May 3, 2015 at 8:18 AM, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > uWSGI logs have some messages, but nothing about any errors. In this  
> > you looking for, see above.  
> > When my app has, for example, a syntax error, then yes, that appears  
> > in the uWSGI log. But what I was talking about are the HTTP errors  
> > like a 500 or a 400. When I get those there’s nothing in the logs.
