Skip to content

Commit

Permalink
allows lockfile for log to be in a different directory to log file it…
Browse files Browse the repository at this point in the history
…self
  • Loading branch information
SandyRogers committed Aug 23, 2023
1 parent c15beeb commit 61af088
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ fixtures/*.sig

.coverage
/build/

loglockdir
logs

secret.key
6 changes: 5 additions & 1 deletion config/local-lite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@ emg:
- 'django.contrib.auth.backends.ModelBackend'
- 'emgapi.backends.EMGBackend'

cors_origin_allow_all: true
debug: true
results_dir: '/opt/emgapi/results'
results_production_dir: '/opt/emgapi/results'
static_root: '/opt/emgapi/staticfiles'
emg_backend_auth: 'https://wwwdev.ebi.ac.uk/ena/dev/submit/webin/auth/login'
secure_cookies: false

log_dir: '/opt/emgapi/logs'
log_lock_dir: '/opt/emgapi/loglockdir'

secret_key: '/opt/emgapi'

mongodb:
db: emg
host: mongodb
Expand Down
2 changes: 1 addition & 1 deletion emgcli/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__: str = "2.4.26"
__version__: str = "2.4.27"
5 changes: 5 additions & 0 deletions emgcli/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
if not os.path.exists(LOGDIR):
os.makedirs(LOGDIR)

LOG_LOCK_DIR = EMG_CONF["emg"].get("log_lock_dir", LOGDIR)
if not os.path.exists(LOG_LOCK_DIR):
os.makedirs(LOG_LOCK_DIR)

LOGFILE = EMG_CONF["emg"].get("log_file", "emg.log")

LOGGING_CLASS = 'concurrent_log_handler.ConcurrentRotatingFileHandler'
Expand Down Expand Up @@ -90,6 +94,7 @@
'level': 'DEBUG',
'class': LOGGING_CLASS,
'filename': os.path.join(LOGDIR, LOGFILE).replace('\\', '/'),
'lock_file_directory': os.path.join(LOG_LOCK_DIR).replace('\\', '/'),
'maxBytes': 1024 * 1024 * 10,
'backupCount': 50,
'formatter': 'default',
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies = [
"yamjam==0.1.7",
"PyYAML==6.0",
# log handler
"concurrent-log-handler~=0.9.22",
"concurrent-log-handler~=0.9.24",
# django
"Django==3.2.18",
"djangorestframework==3.12",
Expand Down Expand Up @@ -116,7 +116,7 @@ max-line-length = 119
"""

[tool.bumpversion]
current_version = "2.4.26"
current_version = "2.4.27"

[[tool.bumpversion.files]]
filename = "emgcli/__init__.py"

0 comments on commit 61af088

Please sign in to comment.