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

How to log properly from a custom handler #17

Open
Fishrock123 opened this issue Oct 23, 2020 · 3 comments
Open

How to log properly from a custom handler #17

Fishrock123 opened this issue Oct 23, 2020 · 3 comments

Comments

@Fishrock123
Copy link

Fishrock123 commented Oct 23, 2020

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.

@horizondeep
Copy link

horizondeep commented Feb 28, 2024

Hi @Fishrock123..Are you able to figure out how to do logging in Rust Custom Handler function. I am also facing the same issue, where logs are working fine in local VS code but after deployment I cannot see them in the panel. Using env_logger/log.

@Fishrock123
Copy link
Author

@sanan-go
Copy link

I have the same issue with golang

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

No branches or pull requests

3 participants