1
votes

I'm not happy with the logging in Azure Functions. I can't easily correlate log entries, it seems like there are times when it loses log entries and the logs aren't permanent enough.

I would like to be able to log to a SQL Sever database and the rest of Azure App Service application use log4net. Without a full config file where we can put custom configuration section it seems the only option would be to programmatically configure the logger.

Is there a way of having a full configuration file for an Azure Function or to read a file from the function's directory that I could then use as an input to the configurator?

Baring these options what is the best way to log from Azure Functions?

1
geekswithblogs.net/tmurphy/archive/2017/02/13/… .. lol you should have plugged your own blog - Steve Coleman
Thanks. I guess I didn't think about linking that after I came up with a solution. - Timothy Murphy

1 Answers

2
votes

Configuration files (web.config/app.config) are not currently supported in Azure Functions, so you'd need to programatically configure log4net.

Not sure if I'd position it as "the best" way to log from Azure Functions, as that will depend on your requirements and is subjective, but one popular approach is to use App Insights.

You can find an example of how to configure and use App Insights here