Skip to content

Commit

Permalink
Merge pull request #588 from liangliangyy/dev
Browse files Browse the repository at this point in the history
为日志文件增加日期分割
  • Loading branch information
liangliangyy authored Jun 20, 2022
2 parents 84a1092 + 019695a commit f59d739
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
16 changes: 12 additions & 4 deletions djangoblog/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ def env_to_bool(env, default):
WXADMIN = os.environ.get(
'DJANGO_WXADMIN_PASSWORD') or '995F03AC401D6CABABAEF756FC4D43C7'

LOG_PATH = os.path.join(BASE_DIR, 'logs')
if not os.path.exists(LOG_PATH):
os.makedirs(LOG_PATH, exist_ok=True)

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
Expand All @@ -241,10 +245,14 @@ def env_to_bool(env, default):
'handlers': {
'log_file': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': 'djangoblog.log',
'maxBytes': 16777216, # 16 MB
'formatter': 'verbose'
'class': 'logging.handlers.TimedRotatingFileHandler',
'filename': os.path.join(LOG_PATH, 'djangoblog.log'),
'when': 'D',
'formatter': 'verbose',
'interval': 1,
'delay': True,
'backupCount': 5,
'encoding': 'utf-8'
},
'console': {
'level': 'DEBUG',
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
coverage==6.4
bleach==5.0.0
Django==4.0.4
Django==4.0.5
django-compressor==4.0
django-haystack==3.2.1
django-ipware==4.0.2
Expand All @@ -19,9 +19,9 @@ python-logstash==0.4.6
python-slugify==6.1.2
pytz==2022.1
raven==6.10.0
requests==2.27.1
requests==2.28.0
urllib3==1.26.9
WeRoBot==1.13.1
Whoosh==2.7.4
user-agents==2.2.0
redis==4.3.1
redis==4.3.3

0 comments on commit f59d739

Please sign in to comment.