mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Enhance logging.
This commit is contained in:
parent
129ee05b51
commit
926935af56
@ -17,10 +17,8 @@ As a last step texts can be loaded into an information retrieval system to query
|
||||
|
||||
## Setup
|
||||
0. **Create log files**
|
||||
``` basj
|
||||
``` bash
|
||||
mkdir /logs
|
||||
touch /logs/opaque_flask.log
|
||||
touch /logs/opaque_daemon.log
|
||||
```
|
||||
|
||||
|
||||
|
@ -36,11 +36,17 @@ class DevelopmentConfig(Config):
|
||||
os.environ.get('POSTGRES_PASSWORD'),
|
||||
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_flask.log', level='WARNING',
|
||||
logging.basicConfig(filename='logs/opaque_web.log', level='WARNING',
|
||||
format=log_format, datefmt='%Y-%m-%d %H:%M:%S',
|
||||
filemode='w')
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.info('Logging has started.')
|
||||
|
||||
|
||||
class TestingConfig(Config):
|
||||
|
@ -19,7 +19,7 @@ services:
|
||||
- /mnt/opaque:/mnt/opaque
|
||||
- ./app:/home/opaque/app
|
||||
- ./config.py:/home/opaque/config.py
|
||||
- ./logs/opaque_flask.log:/home/opaque/logs/opaque_flask.log
|
||||
- ./logs:/home/opaque/logs
|
||||
- ./migrations:/home/opaque/migrations
|
||||
- ./opaque.py:/home/opaque/opaque.py
|
||||
daemon:
|
||||
|
Loading…
Reference in New Issue
Block a user