Comments (7)
Hello @moberacker ,
No problem to add the Trace() extension method.
But with the Critical / Fatal one, I have concerns, because right now the Critical LogLevel already is registering a Fatal message. I will take a deep look and I'll be back to you.
Thank you by your help. Regards.
from microsoft.extensions.logging.log4net.aspnetcore.
Hello again @moberacker ,
Do you have any justification to propose to change from Fatal to Critical?
For me are both the same, considering this SO answer: https://stackoverflow.com/a/5278006/982431
Let me know your thougts on this.
from microsoft.extensions.logging.log4net.aspnetcore.
Hello @huorswords ,
because I think it's more usefull to map Microsoft.Extensions.Logging.LogLevel Critical to the depending level of the underlying Logging Framework if it is available. Maybe you could add an appsettings property to support this mapping by configuration?
Regards,
Markus
from microsoft.extensions.logging.log4net.aspnetcore.
Hello @moberacker ,
I am working for some time on this issue, and I have implemented a way to be able to use Critical instead Fatal following your suggestion and using your extension methods. Thank you very much.
To be able to setup the log level for critical messages within Critical level instead of the fatal one (by default), you should initialize AddLog4Net using a Log4NetProviderOptions class.
The OverrideCriticalLevelWith
property of this class allows you to indicate "Critical"
to let the logger know that should use Critical level instead of the Fatal level when a Critical message is sent to be written by the logger. Any other value, is not considered and use Fatal as default.
You can configure the Log4NetProviderOptions class by two ways:
- Manually on your code.
- When you initialize the log4net logging module, import the appsettings.json section, adding something like the following into your appsettings.json
"Log4NetCore": {
"OverrideCriticalLevelWith": "Critical",
}
Is it a valid approach for you?
Thank you.
from microsoft.extensions.logging.log4net.aspnetcore.
Hello @huorswords ,
yes it's ok but don't forget to also include OverrrideTraceLevelWith : "Trace" to Log4NetCore.
Regrards,
Markus
from microsoft.extensions.logging.log4net.aspnetcore.
Hello,
Not needed. The Trace level itself will be registered as is instead the actual behavior, that is via Debug level.
I will merge the changes as soon as possible and the new release will be available in the same day.
Thank you very much.
from microsoft.extensions.logging.log4net.aspnetcore.
Available on v.2.2.5
Please refer to documentation for more details.
from microsoft.extensions.logging.log4net.aspnetcore.
Related Issues (20)
- Missing Release Notes HOT 2
- Use it in a windows service console application HOT 1
- How to add SMTPAppender HOT 1
- Logging to different Log4Net loggers with dependency injection HOT 1
- Question about name HOT 3
- Thank you for the contribution.
- Does this work with .NET or .NET Core applications? HOT 1
- .net 7 HOT 2
- Need Example Logging Facade Use Outside of ASP HOT 2
- Enable internal debugging HOT 1
- Add .NET 8 support HOT 2
- Missing copyright notice in license
- Upgrading to net8.0 throws exception on startup. HOT 1
- Initialize without a config file HOT 1
- microsoft.extensions.logging.log4net.aspnetcore is missing NuGet package README file
- .NET8.0 XML Exception Problem HOT 4
- EventId Not Showing in Logs
- Logging latest scope value
- How do I configure log4net from in memory configuration xml element? HOT 1
- Any plan to upgrade log4net to 2.0.16 or later?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microsoft.extensions.logging.log4net.aspnetcore.