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
Copy file name to clipboardExpand all lines: README.md
+13-9Lines changed: 13 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# json-logging
2
2
Python logging library to emit JSON log that can be easily indexed and searchable by logging infrastructure such as [ELK](https://www.elastic.co/webinars/introduction-elk-stack).
3
-
If you're using Cloud Foundry, it worth to check out the library [SAP/cf-python-logging-support](https://github.com/SAP/cf-python-logging-support) which I'm also original author and contributor.
3
+
4
+
If you're using Cloud Foundry, it worth to check out the library [SAP/cf-python-logging-support](https://github.com/SAP/cf-python-logging-support) which I'm also original author and contributor.
4
5
# Content
5
6
1.[Features](#1-features)
6
7
2.[Usage](#2-usage)
@@ -17,27 +18,28 @@ If you're using Cloud Foundry, it worth to check out the library [SAP/cf-python-
17
18
18
19
# 1. Features
19
20
1. Lightweight, no dependencies. Tested with Python 2.7 & 3.5.
20
-
2. 100% compatible with **logging** module. Minimal configuration needed.
21
-
3. Emit JSON logs, see here for what kind of log will be emitted. [\[0\]](#0-full-logging-format-references)
21
+
2. 100% compatible with built-in **logging** module. Minimal configuration needed.
22
+
3. Emit JSON logs, see here for detailed log format. [\[0\]](#0-full-logging-format-references)
22
23
4. Support **correlation-id**[\[1\]](#1-what-is-correlation-idrequest-id)
23
-
5. Support request instrumentation. Built in support for [Flask](http://flask.pocoo.org/) & [Sanic](http://flask.pocoo.org/). Extensible to support others.
24
-
6. Support adding extra properties to JSON log object.
24
+
5. Support request instrumentation. Built in support for [Flask](http://flask.pocoo.org/) & [Sanic](http://flask.pocoo.org/). Extensible to support others. Pull Request welcome to add other frameworks' support.
25
+
6. Support inject arbitrary extra properties to JSON log message.
25
26
26
27
# 2. Usage
27
-
This library is very intrusive, once configured library will try to configure all loggers (existing and newly created) to emit log in JSON format.
28
28
Install by running this command:
29
29
> pip install json-logging
30
-
31
-
The most important method is **init(framework_name)**.
32
30
33
-
TODO: update guide on how to use ELK stack to view log
31
+
By default log will be emitted in normal format to ease the local development. To enable it on production set either json_logging.ENABLE_JSON_LOGGING or ENABLE_JSON_LOGGING environment variable to true.
32
+
33
+
To configure, call json_logging.init(framework_name). Once configured library will try to configure all loggers (existing and newly created) to emit log in JSON format. See each use case for more detail.
34
34
35
+
TODO: update guide on how to use ELK stack to view log
0 commit comments