Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* syslog: Made frontik to log into syslog syslogging sysloggin
- Loading branch information
Showing
12 changed files
with
77 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
host = 'localhost' | ||
port = 8080 | ||
host = '0.0.0.0' | ||
port = 8080 | ||
workers_count = 1 | ||
|
||
document_dir = '/var/www/frontik/' | ||
daemonize = False | ||
|
||
log_level = 'debug' | ||
loglevel = 'debug' | ||
logfile = None # log to stderr | ||
|
||
syslog = True | ||
syslog_address = "/dev/log" | ||
|
||
pidfile = None | ||
|
||
apps = { 'page' : '/path/' } | ||
|
||
use_standart_doc = False | ||
|
||
debug = True | ||
debug_login = "hh" | ||
debug_password = "12345" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import logging | ||
import frontik.log as logging | ||
import tornado | ||
import weakref | ||
import xml.sax.saxutils | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
|
||
import tornado.options | ||
import logging | ||
import logging.handlers | ||
from logging import * | ||
|
||
Filterer = logging.Filterer | ||
|
||
if tornado.options.options.syslog: | ||
_syslog_formatter = logging.Formatter('[%(asctime)s %(name)s] %(levelname)s %(message)s') | ||
_handler = logging.handlers.SysLogHandler(facility=logging.handlers.SysLogHandler.LOG_DEBUG, address=tornado.options.options.syslog_address) | ||
_handler.setFormatter(_syslog_formatter) | ||
|
||
def getLogger(*args, **kwargs): | ||
log = logging.getLogger(*args, **kwargs) | ||
|
||
if tornado.options.options.syslog: | ||
tornado.options.options.syslog | ||
log.addHandler(_handler) | ||
return log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,3 +176,4 @@ def _asciify_url_char(c): | |
|
||
def asciify_url(url): | ||
return ''.join(map(_asciify_url_char, url)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import logging | ||
import frontik.log as logging | ||
import os.path | ||
|
||
from frontik import etree | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
host = '0.0.0.0' | ||
port = 8080 | ||
workers_count = 1 | ||
|
||
daemonize = False | ||
|
||
loglevel = 'debug' | ||
logfile = None # log to stderr | ||
|
||
syslog = True | ||
syslog_address = "/dev/log" | ||
syslog_only = True | ||
|
||
pidfile = None | ||
|
||
apps = { 'zubov' : '/home/meerkat/work/frontik-www/frontik_www', | ||
'proxy': '/home/meerkat/work/partner_proxy' } | ||
|
||
use_standart_doc = False | ||
|
||
debug = True | ||
debug_login = "hh" | ||
debug_password = "12345" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5951e47
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Дима, а зачем ты сделал это так странно?
Достаточно было в frontik_srv.py повесить syslog_handler на рутовый логгер.
Текущее решение не очень хорошее, потому что обязывает использовать frontik.log вместо стандартного logging, люди об этом забывают.
5951e47
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Да, ты прав.