Thanks for reaching out to Q&A forum.
I am sorry that you had to go through a lot of documents for logging. A simple approach is to use the inbuilt getlogger to log warning/critical/informational messages in functions so that it can be viewed in the Application insights
public class Function {
public String echo(@HttpTrigger(name = "req", methods = {HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) String req, ExecutionContext context) {
if (req.isEmpty()) {
context.getLogger().warning("Empty request body received by function " + context.getFunctionName() + " with invocation " + context.getInvocationId());
}
return String.format(req);
}
}
You can configure the log levels in the host.json file as mentioned in the below article,
You can view the logs in the monitor section of the Function app which has the invocation logs or you can also view the additional and granular logging in the log analytics workspace as well. In the log analytics workspace, you can run queries on the Traces table
You can use the Azure CLI to stream Java stdout and stderr logging, as well as other application logging : https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=bash%2Cconsumption#view-logs-and-trace
Hope this helps! Feel free to reach out to me if you have any queries or concerns.