You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@liminal.apache.org by li...@apache.org on 2021/01/11 16:19:24 UTC
[incubator-liminal] branch master updated: add mkdir logs dir
This is an automated email from the ASF dual-hosted git repository.
lior pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-liminal.git
The following commit(s) were added to refs/heads/master by this push:
new a9166c5 add mkdir logs dir
new c7a474b Merge pull request #21 from aviemzur/add-mkdir-logs-dir
a9166c5 is described below
commit a9166c53ac64b0279d8206fcbbe9864f5b24a538
Author: aviemzur <av...@gmail.com>
AuthorDate: Mon Jan 11 17:00:00 2021 +0200
add mkdir logs dir
---
liminal/logging/logging_setup.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/liminal/logging/logging_setup.py b/liminal/logging/logging_setup.py
index 995fa02..0765ef1 100644
--- a/liminal/logging/logging_setup.py
+++ b/liminal/logging/logging_setup.py
@@ -17,12 +17,13 @@
# under the License.
import logging
+import os
from logging.handlers import RotatingFileHandler
from liminal.core import environment
-LIMINAL = 'liminal'
LOGS_DIR = 'logs'
+LOG_FILENAME = 'liminal.log'
MAX_FILE_SIZE = 10485760 # 10 MB
@@ -34,11 +35,15 @@ def logging_initialization():
'%m-%d %H:%M:%S'
)
+ logs_dir = os.path.join(environment.get_liminal_home(), LOGS_DIR)
+ os.makedirs(logs_dir, exist_ok=True)
+
file_handler = RotatingFileHandler(
- f'{environment.get_liminal_home()}/{LOGS_DIR}/{LIMINAL}.log',
+ os.path.join(logs_dir, LOG_FILENAME),
maxBytes=MAX_FILE_SIZE,
backupCount=3
)
+
root_logger.addHandler(file_handler)
root_logger.setLevel(logging.INFO)