Comments (9)
I change version and result 2 seconds delay.
Looks like the pre-release-build has improved the performance.
Looked at your test-application. And it seems the "Hide assemblies for callsite"
comes from each of the 100 threads setting up their own DI-Container with new NLog-LoggingProvider. Where each the NLog-LoggingProvider marks the same Microsoft-extension-logging-dlls to be excluded in callsite-stacktrace-filtering (if callsite should be used).
The same 100 NLog-LoggingProvider performs implicit Flush on thread-exit (when disposing DI-container), thus also causing the frequent logging of "LogFactory Flush with timeout=15 secs"
from nlog.mongo.
@iozcelik There is now an updated nuget-package, that should match the pre-release:
https://www.nuget.org/packages/NLog.Mongo/
from nlog.mongo.
Try changing from this:
<target name="mongoTest" xsi:type="AsyncWrapper">
To include overflowAction (Default is Discard):
<target name="mongoTest" xsi:type="AsyncWrapper" overflowAction="Grow">
Maybe missing loglines is because you have configured cappedCollectionSize
.
NLog.Mongo/src/NLog.Mongo/MongoTarget.cs
Lines 413 to 422 in ef7c483
Looks like #25 also complains about startup delay. Have created #41 for using NLog InternalLogger for performance measurements when connecting.
Maybe you can try this pre-release-nuget-package and report the output from NLog InternalLogger (At Debug-Level):
https://ci.appveyor.com/project/LoreSoft/nlog-mongo/builds/33782375/artifacts
from nlog.mongo.
I change and try pre-nuget package but it is same.
As you can see from screenshot, the delay is almost 2 minutes. I think miliseconds delays are acceptable but over minutes delays are huge.
from nlog.mongo.
from nlog.mongo.
I attach all file from last run.
from nlog.mongo.
from nlog.mongo.
Sorry, l forget change version before last test. I change version and result 2 seconds delay.
All code is here:
public static class NLogTest {
public static void StartTest() {
var logger = LogManager.GetCurrentClassLogger();
try {
var config = new ConfigurationBuilder()
.SetBasePath(System.IO.Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.Build();
logger.Info("Başladı");
for (int i = 0; i < 100; i++) {
new Thread(() => {
var servicesProvider = BuildDi(config);
using (servicesProvider as IDisposable) {
var runner = servicesProvider.GetRequiredService<LogTest>();
runner.DoAction("NLog",i);
}
}).Start();
}
Console.WriteLine("Press ANY key to exit");
Console.ReadKey();
} catch (Exception ex) {
Console.WriteLine(ex);
logger.Error(ex, "Stopped program because of exception");
throw;
} finally {
Console.WriteLine("Logger kapandı");
LogManager.Shutdown();
}
}
private static IServiceProvider BuildDi(IConfiguration config) {
return new ServiceCollection()
.AddTransient<LogTest>()
.AddLogging(loggingBuilder => {
loggingBuilder.ClearProviders();
loggingBuilder.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
loggingBuilder.AddNLog(config);
})
.BuildServiceProvider();
}
}
public class LogTest {
private readonly ILogger<LogTest> _logger;
public LogTest(ILogger<LogTest> logger) {
_logger = logger;
}
public void DoAction(string name,int id) {
for (int i = 0; i < 100; i++) {
_logger.LogInformation(id, "Doing hard work! {Action}", name);
}
}
}
from nlog.mongo.
Looked at your test-application. And it seems the "Hide assemblies for callsite" comes from each of the 100 threads setting up their own DI-Container with new NLog-LoggingProvider. Where each the NLog-LoggingProvider marks the same Microsoft-extension-logging-dlls to be excluded in callsite-stacktrace-filtering (if callsite should be used).
Thanks I see, however my main aim is testing nlog mongo and I think I will use in my service.
from nlog.mongo.
Related Issues (20)
- Push latest version to nuget.org HOT 2
- How to use code mode to add fields HOT 1
- Log properties Event.Id is cause problem, I had to change line 255 to this string key = Convert.ToString(property.Key, CultureInfo.InvariantCulture).Replace('.', '_'); HOT 2
- Remove try-catch from target single LogEventInfo Write override HOT 3
- 关于this.AddProperties(bsonDocument, logEvent);内部方法问题
- “field - Specifies a root level document field.” "${var}" In mongodb, not a root field, but a property of a field。 HOT 1
- connect to non-local db HOT 1
- How to add HostIp address HOT 2
- Complete Custom Document duplicate info and properties HOT 4
- Connection string from appsetting.json HOT 6
- Logging properties into Mongodb but with extra "properties" object in json HOT 2
- First call of logger.Info extremely slow HOT 2
- fail to connet to mongo db HOT 1
- Target does not update on LogManager.ReconfigExistingLoggers(); HOT 1
- User Admin HOT 3
- Support for Specifying SSL Cert HOT 1
- BsonString exception thrown when Source is null HOT 2
- "Invalid Token" using NLog.Mongo in .Net Core HOT 3
- appsettings.json with Mongo HOT 2
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 nlog.mongo.