azure-functions-host: Function execution logs are duplicated in App Service log stream

If you access the log stream for your entire function app, you will see duplicated entries for function starting/completion:

image

When a function executes with file logging enabled, the following entries are written to both the host log and the function log, i.e. to files in:

  • D:\home\LogFiles\Application\Functions\Host\

  • D:\home\LogFiles\Application\Functions\Function\function-name\

The entries look like this:

2017-04-18T22:54:20.013 Function started (Id=8c130624-cfb2-47d7-8e1f-05047a10a17d)
2017-04-18T22:54:20.013 Function completed (Success, Id=8c130624-cfb2-47d7-8e1f-05047a10a17d, Duration=0ms)

Because the same entry is written to both locations, it appears in the log stream twice.

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 10
  • Comments: 28 (11 by maintainers)

Most upvoted comments

This is highly confusing and just cost me a few hours of searching for the reason. It should be fixed or one need to somehow be warned.

Five years later and this is still a nuisance. Any solution in sight?

@MatheusNani That’s a duplicate execution, not an unexpected duplicate log entry. You may have better luck asking on stackoverflow.

I have a similar issue with a Timer Trigger Function. For some reason it’s being kickoff twice in a row and I’m getting duplicate emails. Any updates regarding this issue?

image

Also I found a workaround - add --provider application/functions/host

We think Mathew’s suggested approach makes sense. I should have another update in a few weeks. While the work is happening in a different component, I’ll leave this issue open for the time being.