Logging¶
Classes¶
Logging¶
Logging.
add_logger¶
add_logger_encoder¶
-
Encoder to be used only for requests information messages.
-
Encoder to be used in single-worker setup.
Add an item in the log encoder or request encoder chain.
-
http://uwsgi-docs.readthedocs.io/en/latest/LogEncoders.html
.. note:: Encoders automatically enable master log handling (see
.set_master_logging_params())... note:: For best performance consider allocating a thread for log sending with
dedicate_thread.
add_logger_route¶
log_into¶
set_basic_params¶
-
Disable requests logging - only uWSGI internal messages and errors will be logged.
-
Set advanced format for request logging. This template string can use variables from
Logging.Vars. -
Enable memory report.
- 1 - basic (default);
- 2 - uss/pss (Linux only)
-
Prefix log items with a string.
1.. note:: This will not work with `prefix_date` option. -
Prefix log items with date string.
1 2 3 4
.. note:: This will not work with `prefix` option. .. note:: This can be ``True`` or contain formatting placeholders (e.g. %Y-%m-%d %H:%M:%S) if used with ``apply_strftime``. -
Apply strftime to dates in log entries. E.g.
prefix_datecan contain format placeholders. See alsovars.REQ_START_FORMATTED. -
Report response time in microseconds instead of milliseconds.
-
Use the IP from X-Forwarded-For header instead of REMOTE_ADDR. Used when uWSGI is run behind multiple proxies.
set_file_params¶
-
Reopen log after reload.
-
Truncate log on startup.
-
Set maximum logfile size in bytes after which log should be rotated.
-
Set log file name after rotation.
-
Trigger log reopen if the specified file is modified/touched.
Note
This can be set to a file touched by
postrotatescript oflogrotateto implement rotation. -
Trigger log rotation if the specified file is modified/touched.
-
Set owner chown() for logs.
-
Set mode chmod() for logs.
Set various parameters related to file logging.
set_filters¶
-
Show only log lines matching the specified regexp.
1.. note:: Requires enabled PCRE support. -
Do not show log lines matching the specified regexp.
1.. note:: Requires enabled PCRE support. -
Log (annoying) write()/writev() errors. Default:
True.1 2
.. note:: If both this and ``sigpipe`` set to ``False``, it's the same as setting ``write-errors-exception-only`` uWSGI option. -
Set the maximum number of allowed write errors before exception is raised. Default: no tolerance.
Note
Available for Python, Perl, PHP.
-
Log (annoying) SIGPIPE. Default:
True.1 2
.. note:: If both this and ``write_errors`` set to ``False``, it's the same as setting ``write-errors-exception-only`` uWSGI option.
Set various log data filters.
set_master_logging_params¶
-
Delegate logging to master process. Delegate the write of the logs to the master process (this will put all of the logging I/O to a single process). Useful for system with advanced I/O schedulers/elevators.
-
Delegate log writing to a thread.
1 2 3
As error situations could cause the master to block while writing a log line to a remote server, it may be a good idea to use this option and delegate writes to a secondary thread. -
Set the buffer size for the master logger in bytes. Bigger log messages will be truncated.
-
Create the master logpipe as SOCK_STREAM.
-
Create the master requests logpipe as SOCK_STREAM.
Sets logging params for delegating logging to master process.
set_requests_filters¶
-
Log requests slower than the specified number of milliseconds.
-
Log requests bigger than the specified size in bytes.
-
Log requests with a 4xx response.
-
Log requests with a 5xx response.
-
Log responses without body.
-
Log sendfile requests.
-
Log requests with io errors.
Set various log data filters.