Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add request-id to verbose log messages #173

Merged
merged 1 commit into from
Sep 14, 2017
Merged

Add request-id to verbose log messages #173

merged 1 commit into from
Sep 14, 2017

Conversation

ivanpesin
Copy link
Contributor

This is a proposed enhancement for log messages in verbose mode.

It is difficult to track log messages for a specific request if multiple concurrent requests are being handled by webhook. This PR adds request id string in front of each log message, so it is easy to track relation between log messages and requests.

Example:

[webhook] 2017/09/12 23:10:11 serving hooks on http://0.0.0.0:9000/hooks/{id}
[webhook] 2017/09/12 23:10:17 [e70a0a] incoming HTTP request from [::1]:60390
[webhook] 2017/09/12 23:10:17 [e70a0a] sleep got matched
[webhook] 2017/09/12 23:10:17 [e70a0a] sleep hook triggered successfully
[webhook] 2017/09/12 23:10:17 [e70a0a] executing /tmp/sleep-test.bsh (/tmp/sleep-test.bsh) with arguments ["/tmp/sleep-test.bsh"] and environment [] using /tmp as cwd
[webhook] 2017/09/12 23:10:18 [42e6a9] incoming HTTP request from [::1]:60392
[webhook] 2017/09/12 23:10:18 [42e6a9] sleep got matched
[webhook] 2017/09/12 23:10:18 [42e6a9] sleep hook triggered successfully
[webhook] 2017/09/12 23:10:18 [42e6a9] executing /tmp/sleep-test.bsh (/tmp/sleep-test.bsh) with arguments ["/tmp/sleep-test.bsh"] and environment [] using /tmp as cwd
[webhook] 2017/09/12 23:10:22 [e70a0a] command output: Woke up!
[webhook] 2017/09/12 23:10:22 [e70a0a] finished handling sleep
[webhook] 2017/09/12 23:10:22 200 | 5.015660573s | localhost:9000 | GET /hooks/sleep
[webhook] 2017/09/12 23:10:23 [42e6a9] command output: Woke up!
[webhook] 2017/09/12 23:10:23 [42e6a9] finished handling sleep
[webhook] 2017/09/12 23:10:23 200 | 5.01321799s | localhost:9000 | GET /hooks/sleep

Let me know if you find this useful.

@hassanbabaie
Copy link
Contributor

This would be really nice to have!

@adnanh adnanh merged commit 71269d8 into adnanh:development Sep 14, 2017
col-panic added a commit to col-panic/webhook that referenced this pull request Nov 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants