Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 5d0bd1b

Browse files
committed
logging also in stdout
1 parent e843d15 commit 5d0bd1b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

flask_rp/wsgi.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@
1313
RP_LOGFILE_NAME = os.environ.get('RP_LOGFILE_NAME', 'flrp.log')
1414

1515
hdlr = logging.FileHandler(RP_LOGFILE_NAME)
16-
base_formatter = logging.Formatter(
17-
"%(asctime)s %(name)s:%(levelname)s %(message)s [%(name)s.%(funcName)s:%(lineno)s]")
16+
log_format = ("%(asctime)s %(name)s:%(levelname)s "
17+
"%(message)s [%(name)s.%(funcName)s:%(lineno)s]")
18+
base_formatter = logging.Formatter(log_format)
1819

1920
hdlr.setFormatter(base_formatter)
2021
logger.addHandler(hdlr)
2122
logger.setLevel(logging.DEBUG)
2223

24+
stdout = logging.StreamHandler()
25+
stdout.setFormatter(base_formatter)
26+
logger.addHandler(stdout)
27+
2328
dir_path = os.path.dirname(os.path.realpath(__file__))
2429

2530
if __name__ == "__main__":

0 commit comments

Comments
 (0)