Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ILogger<T> not logging when T is another project #6998

Open
SinghManvir opened this issue Dec 15, 2020 · 7 comments
Open

ILogger<T> not logging when T is another project #6998

SinghManvir opened this issue Dec 15, 2020 · 7 comments

Comments

@SinghManvir
Copy link

I can see all logs in my functions class but it does not seem to be logging anything from another class in another project.

I have tried all suggestions in issue 4345 and issue 4425.

So, I have tried adding the filter like

services.AddLogging(loggingBuilder =>
{
     loggingBuilder.SetMinimumLevel(LogLevel.Debug);
     loggingBuilder.AddFilter(typeof(Service1).FullName, LogLevel.Debug);
});

and also tried in host.json

"logLevel": {
   // For all functions
   "Function": "Debug",
   "X.Domain.Suppliers.Service1": "Information",
}

and tried the solution name as well like

"logLevel": {
   // For all functions
   "Function": "Debug",
   "X-API": "Information",
}

I am running this locally with Core Tools Version: 3.0.3160, Function Runtime Version: 3.0.14916.0

@anthonychu
Copy link
Member

@SinghManvir Are you looking to see these logs in the console? Can you please try to run func with the --verbose flag? Also would be great to know if the logs are missing in Application Insights in production as well?

Also, can you try setting the default log level to Information?

"logLevel": {
   "default": "Information"
}

@SinghManvir
Copy link
Author

Yes, I am trying to see the logs in the console, but they are also missing in App Insights in Production.
I have had "default": "Information", only took it out to see if that made a change.

I will try running the function with verbose flag.

@SinghManvir
Copy link
Author

@anthonychu - Tried adding start --verbose to the Application arguments in project properties and no luck.
In case it helps, I can see my service listed in the Logger Filter Options

[2020-12-16T11:23:14.789Z] LoggerFilterOptions
[2020-12-16T11:23:14.791Z] {
[2020-12-16T11:23:14.792Z]   "MinLevel": "None",
[2020-12-16T11:23:14.794Z]   "Rules": [
[2020-12-16T11:23:14.795Z]     {
[2020-12-16T11:23:14.796Z]       "ProviderName": null,
[2020-12-16T11:23:14.797Z]       "CategoryName": null,
[2020-12-16T11:23:14.799Z]       "LogLevel": null,
[2020-12-16T11:23:14.802Z]       "Filter": "<AddFilter>b__0"
[2020-12-16T11:23:14.803Z]     },
[2020-12-16T11:23:14.804Z]     {
[2020-12-16T11:23:14.805Z]       "ProviderName": null,
[2020-12-16T11:23:14.807Z]       "CategoryName": "X.Domain.Suppliers.Service1",
[2020-12-16T11:23:14.808Z]       "LogLevel": "Information",
[2020-12-16T11:23:14.810Z]       "Filter": null
[2020-12-16T11:23:14.811Z]     },
[2020-12-16T11:23:14.812Z]     {
[2020-12-16T11:23:14.814Z]       "ProviderName": null,
[2020-12-16T11:23:14.815Z]       "CategoryName": "Function",
[2020-12-16T11:23:14.816Z]       "LogLevel": "Debug",
[2020-12-16T11:23:14.818Z]       "Filter": null
[2020-12-16T11:23:14.820Z]     },
[2020-12-16T11:23:14.821Z]     {
[2020-12-16T11:23:14.822Z]       "ProviderName": null,
[2020-12-16T11:23:14.823Z]       "CategoryName": null,
[2020-12-16T11:23:14.824Z]       "LogLevel": "Information",
[2020-12-16T11:23:14.826Z]       "Filter": null
[2020-12-16T11:23:14.826Z]     },
[2020-12-16T11:23:14.830Z]     {
[2020-12-16T11:23:14.831Z]       "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[2020-12-16T11:23:14.832Z]       "CategoryName": null,
[2020-12-16T11:23:14.833Z]       "LogLevel": "None",
[2020-12-16T11:23:14.834Z]       "Filter": null
[2020-12-16T11:23:14.836Z]     },
[2020-12-16T11:23:14.837Z]     {
[2020-12-16T11:23:14.839Z]       "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[2020-12-16T11:23:14.840Z]       "CategoryName": null,
[2020-12-16T11:23:14.841Z]       "LogLevel": null,
[2020-12-16T11:23:14.843Z]       "Filter": "<AddFilter>b__0"
[2020-12-16T11:23:14.844Z]     },
[2020-12-16T11:23:14.845Z]     {
[2020-12-16T11:23:14.846Z]       "ProviderName": "Azure.Functions.Cli.Diagnostics.ColoredConsoleLoggerProvider",
[2020-12-16T11:23:14.848Z]       "CategoryName": null,
[2020-12-16T11:23:14.849Z]       "LogLevel": null,
[2020-12-16T11:23:14.850Z]       "Filter": "<AddFilter>b__0"
[2020-12-16T11:23:14.851Z]     },
[2020-12-16T11:23:14.853Z]     {
[2020-12-16T11:23:14.854Z]       "ProviderName": "Microsoft.Azure.WebJobs.Logging.ApplicationInsights.ApplicationInsightsLoggerProvider",
[2020-12-16T11:23:14.856Z]       "CategoryName": null,
[2020-12-16T11:23:14.857Z]       "LogLevel": "Trace",
[2020-12-16T11:23:14.858Z]       "Filter": null
[2020-12-16T11:23:14.862Z]     }
[2020-12-16T11:23:14.863Z]   ]
[2020-12-16T11:23:14.864Z] }

@anthonychu
Copy link
Member

@pragnagopa @brettsam Do you have any thoughts?

@pragnagopa
Copy link
Member

As the logs are missing from AppInsights as well, this looks related to #4345
I will transfer this issue to host as issue is not related to Core-Tools.

@pragnagopa pragnagopa transferred this issue from Azure/azure-functions-core-tools Dec 18, 2020
@ghost ghost assigned soninaren Dec 18, 2020
@pragnagopa pragnagopa added this to the Triaged milestone Dec 18, 2020
@pragnagopa
Copy link
Member

tagging @brettsam and @anthonychu

@hachanMSFT
Copy link

hachanMSFT commented Dec 21, 2021

I am having the same issue, Ilogger in another project is not getting logs, did you find a work around? @SinghManvir

Also tagging @brettsam and @anthonychu

@fabiocav fabiocav removed this from the Triaged milestone Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants