Logging written to the ILogger does not appear in the CLI
Seems that it's still not fixed. Guess this ScriptHostHelper passes null, instead of ILogger instance.
@lindydonna Would you mind providing a rough timeline for this? I'm currently on beta.99.
I am running 1.0.2 and am still not seeing logs written to the CLI. Is this working for others yet? I'm running VS 15.3.1.
Just in case it is at all related I regularly find the logging on Azure just stops, requiring a restart. I'm using javascript.
Any news on this issue?
I'm getting a similar issue, no log entries for Microsoft.Extensions.Logging.ILogger are being output to the CLI nor the Portal.
Also experiencing this issue recently. I've been forced to revert to the TraceWriter until it's fixed
We have the same problem, no log are shown in the azure-portal.
I am using CLI 1.0.9 and it still does not work.
If I use TraceWriter, the entries are displayed in the console when debugging in VS2017. If I switch to ILogger, nothing is rendered to the console.
same for me as @roryprimrose says.
I'm now using an Autofac module to create ILogger
This doesn't log any messages to the console when debugging locally. Similarly, it also doesn't log to the log in the Azure portal. It does however log entries to Application Insights although it is difficult to get access to this data. The only way I've been able to do it so far is to run AI analysis queries over log data. I haven't been able to figure out a nice way of getting to the log data from the Azure portal itself.
@roryprimrose How do you access the logger factory from the azure function context? If I add an ILoggerFactory parameter to the Run method my function fails to run with a binding error. Only a parameter type of ILogger resolves an instance from the function host.
Using 1.0.12... does the ILogger work at all? Is the guidance/expectation to use TraceWriter instead?
@MrGlenThomas Sorry, took me a little while to get back to this. I've just posted about doing dependency injection with ILogger and ILogger<T> in Azure Functions. See https://www.neovolve.com/2018/04/05/dependency-injection-and-ilogger-in-azure-functions/
As far as I can tell this bug is fixed when running against functions V2 (beta). Still annoying for it to be busted for V1 though.
The fix for this is now merged in #437 and will be a part of the next CLI release.
I don't know if what I am experiencing is related to this issue:
[FunctionName("run-function")]
public async Task RunAsync([QueueTrigger("request-run-function")] Section sectionRequest, ILogger logger, CancellationToken token)
Special Thanks for the help @brettsam @paulbatum
What version of the CLI are you using? 1.0.12 should have this fixed.
I'm looking right on azure portal https://
Oh sorry -- this issue is explicitly for the Functions CLI. I misread your comment. I've created a new issue here that we can follow-up on: https://github.com/Azure/azure-webjobs-sdk/issues/1716
I was able to use the ILogger from the Microsoft.Extensions.Logging library in my Azure Function project. However, when trying to do the same in my unittest project, which is using Moq I am unable to use it.

then, if I try Ctrl + . I get:

What am I doing wrong?
I think either your unit test project is missing a reference to Microsoft.Extensions.Logging, or its hitting a naming conflict and you should try declaring the type with its fully qualified name Microsoft.Extensions.Logging.ILogger.
Most helpful comment
We have the same problem, no log are shown in the azure-portal.