You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2016-04-05 22:12:32,984 [Thread-1 ] [DEBUG] [djangoproject.logger] This is a manually logged DEBUG string.
Follow the convension of variable names in naming events in logs also be precise with the naming.
Naming events with spaces may result in more readablity but there is difficulty in filtering, storage in Storage-engines as some databases do not support storing key names with spaces.
log.info("%s records into database", %(length(r)))
Do not write unnecesary logs especially in info mode
Writing too many logs put a lot of load on the collection pipeline, Storage also becomes an issue.
馃憤
log.debug("starting_function", fn=fn.__name__)
馃憥
log.info("starting_function")
Identify the requirement for writing metrics
Some databases/storages like influxDB work out-of-the-box for metrics, so it is useful to tag the metrics in the logs beforehand so that we can direct them to these storages with ease.
Logging: Best practices
Do structured logging:
Because parsing stuctured logs are easier.
馃憤
馃憥
Follow the convension of variable names in naming events in logs also be precise with the naming.
Naming events with spaces may result in more readablity but there is difficulty in filtering, storage in Storage-engines as some databases do not support storing key names with spaces.
馃憤
馃憥
Do not write unnecesary logs especially in
info mode
Writing too many logs put a lot of load on the collection pipeline, Storage also becomes an issue.
馃憤
馃憥
Identify the requirement for writing metrics
Some databases/storages like influxDB work out-of-the-box for metrics, so it is useful to tag the metrics in the logs beforehand so that we can direct them to these storages with ease.
馃憤
馃憥
Use '_' and '__' especially when logging metrics for fields that are supposed to be not indexed and supposed to be private respectively
Indexing a lot of variable stings like ids may decrease performance of databases
馃憤
Refer to link for more information
The text was updated successfully, but these errors were encountered: