Another log-related new feature.

Currently you can define multiple loggers for the same uWSGI instance.

Each log-line for example can be sent at the same time to a socket, a
mongodb server and a redis server.

A new option (--log-route) allows you to define which log lines go to one
server and which one to another.

The first step is giving a "name" to a logger:

[uwsgi]
logger = mylogger1 syslog
logger = theredisone redislog:127.0.0.1:6269
logger = theredistwo redislog:127.0.0.1:6270
logger = file:/tmp/foobar
logger = internalservererror file:/tmp/errors

as you can note, the fourth logger has no name, that means it will blindly
log whatever it receives. The other loggers has to be 'called'

To call a logger you use the --log-route <name> <regexp> option

[uwsgi]
...
log-route = internalservererror (HTTP/1.\d 500)
log-route = mylogger1 uWSGI listen queue of socket .* full

this will log all of the errors 500 to the file /tmp/errors, while it will
log "listen queue full" messages to the syslog. All of the other will go
to /tmp/foobar

You may find similarities with the alarm subsystem, in-fact they work
pretty similar, the only difference is that 'alarm' plugins are generally
heavier than loggers, and you should always use alarms only on critical
situations (while logs could be stored only for statistics/analysis)

Currently the most obvious usage (as it has been requested in the old
ticketing system) is for splitting request logs from stdout/stderr.

You can continuosly log stdout/stderr to a standarg logfile, while you can
forward request logging to a udp server you may want to turn on only when
needed (so you can get the request logs only when you need it)

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to