nids-io / ampt-manager

Management service for the AMPT passive network tools monitor
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Standardize and normalize logging #2

Open dspruell opened 7 years ago

dspruell commented 7 years ago

As currently implemented, logging in the application is a mish-mash and haphazardly results in different log formats from various packages and modules intermixed in the log stream.

e.g. the first lines at startup are from the app, using one format, and subsequent lines are from Gunicorn using a different format.

$ ./venv.d/ampt-manager/bin/ampt-manager run -l info ./ampt/ampt_manager.conf
2017-09-18 20:01:58,646: [INFO] Starting AMPT Manager
2017-09-18 20:01:58,646: [INFO] Configuring server for TLS using PROTOCOL_TLSv1_2 and cipher set TLSv1 (OpenSSL 1.0.2l  25 May 2017)
[2017-09-18 20:01:58 -0700] [12228] [INFO] Starting gunicorn 19.7.1
[2017-09-18 20:01:58 -0700] [12228] [INFO] Listening at: https://127.0.0.1:8443 (12228)
[2017-09-18 20:01:58 -0700] [12228] [INFO] Using worker: sync
[2017-09-18 20:01:58 -0700] [12231] [INFO] Booting worker with pid: 12231
[2017-09-18 20:01:58 -0700] [12232] [INFO] Booting worker with pid: 12232
[2017-09-18 20:01:58 -0700] [12233] [INFO] Booting worker with pid: 12233
[2017-09-18 20:01:58 -0700] [12234] [INFO] Booting worker with pid: 12234
[2017-09-18 20:01:58 -0700] [12235] [INFO] Booting worker with pid: 12235
...
[2017-09-18 20:01:33 -0700] [11155] [INFO] Handling signal: int
[2017-09-18 20:01:34 -0700] [11160] [INFO] Worker exiting (pid: 11160)
[2017-09-18 20:01:34 -0700] [11161] [INFO] Worker exiting (pid: 11161)
[2017-09-18 20:01:34 -0700] [11159] [INFO] Worker exiting (pid: 11159)
[2017-09-18 20:01:34 -0700] [11158] [INFO] Worker exiting (pid: 11158)
[2017-09-18 20:01:34 -0700] [11162] [INFO] Worker exiting (pid: 11162)
[2017-09-18 20:01:34 -0700] [11155] [INFO] Shutting down: Master

e.g. a resize of the terminal the manager is running in drops this INFO logging:

[2017-09-18 18:02:52 -0700] [11155] [INFO] Handling signal: winch                                                      

e.g. logging sent to stdio logging from Gunicorn doesn't go to the ampt.log.