I'm a bit confused about my options for Function App logging on Azure. Is Application Insights the only mechanism available to observe the output logged through the function application's context? In other words, can logs be tailed or log files be temporarily observed anywhere without draining to an instance of Application Insights?
1 Answer
You can also configure Azure Functions with NLog:
Here you can find a sample that shows an Azure Function with NLog and GrayLog
Logging API Requests and Responses to GrayLog over Azure API Management using Azure Functions
nlog.config:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off">
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
<add assembly="NLog.Web.AspNetCore.Targets.Gelf"/>
</extensions>
<targets>
<target xsi:type="Gelf" name="graylog" endpoint="udp://localhost:12201" facility="APM.RequestLogging.Function" SendLastFormatParameter="true" />
</targets>
<rules>
<logger level="Info" writeTo="graylog" />
</rules>
</nlog>