add log to file option, closes #103
This commit is contained in:
parent
8a58afc8e6
commit
0f1b95a125
@ -44,6 +44,7 @@ session key and hostname. Here are the default values for this section:
|
||||
host =
|
||||
max-age = 15m
|
||||
notify = stdout
|
||||
log-file =
|
||||
|
||||
dbpath
|
||||
file location to the SQLite3 database, highly recommended to change this
|
||||
@ -86,6 +87,9 @@ notify
|
||||
Send notifications via SMTP on new comments with activation (if
|
||||
moderated) and deletion links.
|
||||
|
||||
log-file
|
||||
Log console messages to file instead of standard out.
|
||||
|
||||
|
||||
.. _CORS: https://developer.mozilla.org/en/docs/HTTP/Access_control_CORS
|
||||
|
||||
|
@ -70,7 +70,7 @@ from isso.views import comments
|
||||
|
||||
from isso.ext.notifications import Stdout, SMTP
|
||||
|
||||
logging.getLogger('werkzeug').setLevel(logging.ERROR)
|
||||
logging.getLogger('werkzeug').setLevel(logging.WARN)
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s %(levelname)s: %(message)s")
|
||||
@ -232,6 +232,15 @@ def main():
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
if conf.get("general", "log-file"):
|
||||
handler = logging.FileHandler(conf.get("general", "log-file"))
|
||||
|
||||
logger.addHandler(handler)
|
||||
logging.getLogger("werkzeug").addHandler(handler)
|
||||
|
||||
logger.propagate = False
|
||||
logging.getLogger("werkzeug").propagate = False
|
||||
|
||||
if not any(conf.getiter("general", "host")):
|
||||
logger.error("No website(s) configured, Isso won't work.")
|
||||
sys.exit(1)
|
||||
|
@ -96,6 +96,7 @@ class Config:
|
||||
"host = ",
|
||||
"max-age = 15m",
|
||||
"notify = stdout",
|
||||
"log-file = ",
|
||||
"[moderation]",
|
||||
"enabled = false",
|
||||
"purge-after = 30d",
|
||||
|
Loading…
Reference in New Issue
Block a user