Gunicorn log handler for logstash not working
jameelgrand opened this issue · 2 comments
jameelgrand commented
As per gunicorn documentation it is accepting the standard Python logging module’s Configuration file format.
but how can I give logstash handler to gunicorn in configuration file , what is the syntax for that?
I gave like below:
[loggers]
keys=root, logstash
[handlers]
keys=console , logstash
[formatters]
keys=generic, access
[logger_root]
level=INFO
handlers=console
[logger_logstash]
level=DEBUG
handlers=logstash
propagate=1
qualname=logstash
[handler_console]
class=StreamHandler
formatter=generic
args=(sys.stdout, )
[handler_logstash]
class=logstash.TCPLogstashHandler
formatter=generic
args=('localhost',5959)
[formatter_generic]
format=%(asctime)s [%(process)d] [%(levelname)s] %(message)s
datefmt=%Y-%m-%d %H:%M:%S
class=logging.Formatter
[formatter_access]
format=%(message)s
class=logging.Formatter
not working
wizardion commented
To avoid encoding issues in Python 2.7.x, and converting values to Unicode, please use this library: from __future__ import unicode_literals
.
And if you need to convert a special ASCII string to Unicode, please use this example:
from future.utils import text_type
value = text_type('test')
If you still have any problem, please open this issue and report more detailed information about your error.