Skip to content
Snippets Groups Projects
Commit 86b08bc1 authored by Stephan Porada's avatar Stephan Porada :speech_balloon:
Browse files

Add logging for production. Mount web.env into opaque_daemon.

parent 926935af
No related branches found
No related tags found
No related merge requests found
...@@ -46,7 +46,7 @@ class DevelopmentConfig(Config): ...@@ -46,7 +46,7 @@ class DevelopmentConfig(Config):
format=log_format, datefmt='%Y-%m-%d %H:%M:%S', format=log_format, datefmt='%Y-%m-%d %H:%M:%S',
filemode='w') filemode='w')
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logger.info('Logging has started.') logger.info('Logging has started with level WARNING.')
class TestingConfig(Config): class TestingConfig(Config):
...@@ -67,6 +67,17 @@ class ProductionConfig(Config): ...@@ -67,6 +67,17 @@ class ProductionConfig(Config):
os.environ.get('POSTGRES_PASSWORD'), os.environ.get('POSTGRES_PASSWORD'),
os.environ.get('POSTGRES_DB_NAME') os.environ.get('POSTGRES_DB_NAME')
) )
if not os.path.isfile('logs/opaque_web.log'):
file_path = os.path.join(os.getcwd(), 'logs/opaque_web.log')
log = open(file_path, 'w+')
log.close()
log_format = ("%(asctime)s - %(levelname)s - %(name)s - "
"%(filename)s - %(lineno)d - %(message)s")
logging.basicConfig(filename='logs/opaque_web.log', level='ERROR',
format=log_format, datefmt='%Y-%m-%d %H:%M:%S',
filemode='w')
logger = logging.getLogger(__name__)
logger.info('Logging has started with level ERROR.')
config = { config = {
......
...@@ -29,7 +29,9 @@ services: ...@@ -29,7 +29,9 @@ services:
placement: placement:
constraints: constraints:
- node.role == manager - node.role == manager
env_file: db.env env_file:
- db.env
- web.env
image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque_daemon:latest image: gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/opaque_daemon:latest
volumes: volumes:
- ./logs/opaque_daemon.log:/home/opaque_daemon/logs/opaque_daemon.log - ./logs/opaque_daemon.log:/home/opaque_daemon/logs/opaque_daemon.log
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment