Skip to content

Commit ff93923

Browse files
author
Bob Bui
committed
docs update fix #48
1 parent 5d027e3 commit ff93923

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@ if __name__ == "__main__":
151151
app.run()
152152
```
153153

154+
### Custom handler for request instrumentation
155+
you need to explicitly set JSONRequestLogFormatter as default formatter for request_logger
156+
157+
```python
158+
request_logger = json_logging.get_request_logger()
159+
handler = logging.handlers.RotatingFileHandler(filename='log_req.log', maxBytes=5000000, backupCount=10)
160+
handler.setFormatter(json_logging.JSONRequestLogFormatter())
161+
request_logger.addHandler(handler)
162+
```
163+
154164
## 2.3 Get current correlation-id
155165
Current request correlation-id can be retrieved and pass to downstream services call as follow:
156166

0 commit comments

Comments
 (0)