Share via

Azure function logging with python library

Yang Chowmun 411 Reputation points
2021-08-31T10:36:22.687+00:00

I have a few function under one function app and I am doing some process flow logging using python standard library like
from logging.handlers import RotatingFileHandler

I saved the log files in the fileshare. I am expecting all the log files should contain only the function's log but i notice that the log generated by Function A is appear in log files for Function B. Similarly, log generated by Function B is appeared in Function A log files.

Is there any way for us to prevent this condition from happening or is there any setting we could use?

Thanks!

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

0 comments No comments

Answer accepted by question author

Pramod Valavala 20,661 Reputation points Microsoft Employee Moderator
2021-09-16T07:32:25.69+00:00

@Yang Chowmun When initializing RotatingFileHandler, you would just have to pass in different file names for each function and use the right instance as required instead of using the same for all.

Also, by default, function logs will be sent to Azure Application Insights with additional properties like the Function name that you can use to query directly instead of dealing with files, unless you are specifically require file-based logging.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.