mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-22 13:37:21 +00:00
fix logging when under gunicorn
fis returns in reports
This commit is contained in:
parent
b829d666c9
commit
94411568ce
@ -47,6 +47,7 @@ def gen_item_report():
|
|||||||
# Only one report per day
|
# Only one report per day
|
||||||
if report != None:
|
if report != None:
|
||||||
current_app.logger.info(f"Item Report Already Generated for {date}")
|
current_app.logger.info(f"Item Report Already Generated for {date}")
|
||||||
|
return
|
||||||
|
|
||||||
char_xmls = CharacterXML.query.join(
|
char_xmls = CharacterXML.query.join(
|
||||||
CharacterInfo,
|
CharacterInfo,
|
||||||
@ -96,6 +97,7 @@ def gen_currency_report():
|
|||||||
# Only one report per day
|
# Only one report per day
|
||||||
if report != None:
|
if report != None:
|
||||||
current_app.logger.info(f"Currency Report Already Generated for {date}")
|
current_app.logger.info(f"Currency Report Already Generated for {date}")
|
||||||
|
return
|
||||||
|
|
||||||
characters = CharacterXML.query.join(
|
characters = CharacterXML.query.join(
|
||||||
CharacterInfo,
|
CharacterInfo,
|
||||||
@ -139,6 +141,7 @@ def gen_uscore_report():
|
|||||||
# Only one report per day
|
# Only one report per day
|
||||||
if report != None:
|
if report != None:
|
||||||
current_app.logger.info(f"U-Score Report Already Generated for {date}")
|
current_app.logger.info(f"U-Score Report Already Generated for {date}")
|
||||||
|
return
|
||||||
|
|
||||||
characters = CharacterXML.query.join(
|
characters = CharacterXML.query.join(
|
||||||
CharacterInfo,
|
CharacterInfo,
|
||||||
|
11
wsgi.py
11
wsgi.py
@ -13,4 +13,13 @@ def make_shell_context():
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
app.run(host='0.0.0.0')
|
app.run(host='0.0.0.0')
|
||||||
|
else:
|
||||||
|
import logging
|
||||||
|
from loggin.handlers import RotatingFileHandler
|
||||||
|
gunicorn_logger = logging.getLogger('gunicorn.error')
|
||||||
|
app.logger.handlers = gunicorn_logger.handlers
|
||||||
|
file_handler = RotatingFileHandler('nexus_dashboard.log', maxBytes=1024 * 1024 * 100, backupCount=20)
|
||||||
|
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
||||||
|
file_handler.setFormatter(formatter)
|
||||||
|
app.logger.addHandler(file_handler)
|
||||||
|
app.logger.setLevel(gunicorn_logger.level)
|
||||||
|
Loading…
Reference in New Issue
Block a user