anonlink-entity-service icon indicating copy to clipboard operation
anonlink-entity-service copied to clipboard

Configuration of structlog output in logging file

Open hardbyte opened this issue 5 years ago • 1 comments

See https://github.com/n1analytics/entity-service/pull/349#discussion_r273343179

hardbyte avatar Apr 09 '19 10:04 hardbyte

Logging is now configurable, however the defaults are not ideal. Currently the api produces non-colored output like this:

2020-02-04T21:52:05.003340Z [info     ] request to access run result authorized [entityservice.views.run.results] pid=378e01e6922775785142ca4677337cb8376bcde73f077e96 rid=b59715b6217d72bbbb643b2c99e30a4488c37c6bb327a86f
2020-02-04T21:52:05.004156Z [info     ] run state is 'completed'       [entityservice.views.run.results] pid=378e01e6922775785142ca4677337cb8376bcde73f077e96 rid=b59715b6217d72bbbb643b2c99e30a4488c37c6bb327a86f
2020-02-04T21:52:05.009741Z [info     ] Groups result being returned   [entityservice.views.run.results] 

The workers produce ANSI colored output like this:

[2020-02-04 21:52:00,319: INFO/MainProcess] Received task: entityservice.tasks.comparing.compute_filter_similarity[e00390cc-bf78-46f1-a66c-5bd66c56ed96]  
[2020-02-04 21:52:00,329: INFO/ForkPoolWorker-13] 2020-02-04T21:52:00.329383Z [info     ] Unpacking stream of encodings with size 128 - packed as 128 [entityservice.serialization] 
[2020-02-04 21:52:00,346: INFO/ForkPoolWorker-13] 2020-02-04T21:52:00.346468Z [info     ] Unpacking stream of encodings with size 128 - packed as 128 [entityservice.serialization] 

Suggest following http://www.structlog.org/en/stable/standard-library.html and getting these to be consistent

hardbyte avatar Feb 04 '20 22:02 hardbyte