Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable uWSGI logging to a file?

Tags:

logging

ini

uwsgi

I have just installed my first uWSGI server on EC2 Ubuntu 14.04 LTS, using the following configuration:

[uwsgi]
http-socket    = :9001
plugin    = python
wsgi-file = foo.wsgi
chdir = /home/bar
process   = 3

The uWSGI container works fine, but has no logging. Following the manual, I've added the following:

logger = file:/tmp/errlog

But restarting (using sudo service uwsgi restart) did not work - the server would not start with this configuration.

Any idea what's missing from my ini configuration?

like image 469
Adam Matan Avatar asked Jun 01 '14 17:06

Adam Matan


People also ask

Where does uWSGI log to?

Logging to sockets will send log entries to the Unix socket /tmp/uwsgi.

What is Post buffering in uWSGI?

Post-buffering mode (uWSGI >= 2.0. This means that as soon as the uwsgi packet (read: the request headers) is parsed, it is forwarded to the backend/backends. Now, if your web-proxy is a streaming-one too (like apache, or the uWSGI http router), your app could be blocked for ages in case of a request with a body.

What is uWSGI socket?

uWSGI includes an HTTP/HTTPS router/proxy/load-balancer that can forward requests to uWSGI workers. The server can be used in two ways: embedded and standalone. In embedded mode, it will automatically spawn workers and setup the communication socket.

How do I restart uWSGI?

If you change uwsgi systemd service file, reload the daemon and restart the process by typing: sudo systemctl daemon-reload. sudo systemctl restart uwsgi.


1 Answers

The "common" syntax is "logto = file".

The logger option is used for advanced plugins, if you want to use the 'file' one you have to load the logfile plugin (like you load the python one). But honestly if you only want to log to a file, logto will be more than enough

like image 145
roberto Avatar answered Oct 16 '22 23:10

roberto