Azure-Samples / Azure-Samples/functions-custom-handlers

How to log properly from a custom handler

Open
#17 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
94
Forks
32
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm using a custom handler so I write a function in Rust: https://github.com/squamishaccess/squamishaccess-signup-function-rs

My main blocker right now is figuring out how to log properly.
Logging to the stdio only seems to show up in a local (VS Code) log stream, and not in the function monitor panel log stream. Ideally I'd like to make log traces to the "invocations" panel, I'm unsure if that is scraped from file system logs or Application Insights.

Additionally, it doesn't seem to parse JSON logs. Here is an example:

```
2020-10-23T23:05:47.930 [Trace] Sending invocation id:cae182d4-f137-4a62-bc79-76d9265924e1
2020-10-23T23:05:47.930 [Debug] Forwarding httpTrigger invocation for function: 'Paypal-IPN' invocationId: 'cae182d4-f137-4a62-bc79-76d9265924e1'
2020-10-23T23:05:47.931 [Debug] Sending invocation for function: 'Paypal-IPN' invocationId: 'cae182d4-f137-4a62-bc79-76d9265924e1'
2020-10-23T23:05:47.940 [Information] {"level":30,"time":1603494347939,"msg":"<-- Request received","method":POST,"path":/api/Paypal-IPN}
2020-10-23T23:05:47.946 [Information] {"level":30,"time":1603494347939,"msg":"cae182d4-f137-4a62-bc79-76d9265924e1 PayPal IPN Notification Event received successfully."}
```

The lines that say `... [Information] {"level":30, ...` are from my json logger.

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the linked Rust custom-handler sample and reproduce the difference between VS Code stdio logs and the function monitor's invocation stream. Trace how Azure Functions handles custom-handler stdout and structured JSON logs; done means documenting the supported logging path, JSON behavior, and where invocation traces appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, rust
Domain
cloud, observability-sre
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.