mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +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
|
## Setup
|
||||||
0. **Create log files**
|
0. **Create log files**
|
||||||
``` basj
|
``` bash
|
||||||
mkdir /logs
|
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_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 - "
|
log_format = ("%(asctime)s - %(levelname)s - %(name)s - "
|
||||||
"%(filename)s - %(lineno)d - %(message)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',
|
format=log_format, datefmt='%Y-%m-%d %H:%M:%S',
|
||||||
filemode='w')
|
filemode='w')
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
logger.info('Logging has started.')
|
||||||
|
|
||||||
|
|
||||||
class TestingConfig(Config):
|
class TestingConfig(Config):
|
||||||
|
@ -19,7 +19,7 @@ services:
|
|||||||
- /mnt/opaque:/mnt/opaque
|
- /mnt/opaque:/mnt/opaque
|
||||||
- ./app:/home/opaque/app
|
- ./app:/home/opaque/app
|
||||||
- ./config.py:/home/opaque/config.py
|
- ./config.py:/home/opaque/config.py
|
||||||
- ./logs/opaque_flask.log:/home/opaque/logs/opaque_flask.log
|
- ./logs:/home/opaque/logs
|
||||||
- ./migrations:/home/opaque/migrations
|
- ./migrations:/home/opaque/migrations
|
||||||
- ./opaque.py:/home/opaque/opaque.py
|
- ./opaque.py:/home/opaque/opaque.py
|
||||||
daemon:
|
daemon:
|
||||||
|
Loading…
Reference in New Issue
Block a user