Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

nCrunch.TaskRunner.DotNetCore.20.x64 Information prefix for trace output?
GreenMoose
#1 Posted : Monday, March 16, 2020 3:24:08 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 507

Thanks: 145 times
Was thanked: 66 time(s) in 64 post(s)
[v4.0.3.13]

I notice prefix "nCrunch.TaskRunner.DotNetCore.20.x64 Information: 0 : " below when I log information log entries to trace (but not e.g. debug level), is this something NCrunch adds?

Quote:

nCrunch.TaskRunner.DotNetCore.20.x64 Information: 0 : [TEST-16:18:26.5436]|INFO|.AppPackageServiceTests.NLogTest|Test logger


Complete test code:
Quote:

[TestFixture]
internal class NLogTest
{
[Test]
public void CanUseDifferentAppAndTestInstanceLoggers()
{
void RegisterLogging(ServiceCollection services, string prefix)
{
services.AddLogging(loggingBuilder =>
{
Console.WriteLine("Configuring logging.");
loggingBuilder.ClearProviders();
loggingBuilder.SetMinimumLevel(LogLevel.Trace);
var config = new LoggingConfiguration();
//Enables us to use e.g. ThrowOnLogLevelScope helpers and such.
config.LogFactory.ThrowExceptions = true;

var logTrace = new TraceTarget("logTrace")
{
Layout =
"[" + prefix +
"-${time}]|${level:uppercase=true}|${logger:padding=32:fixedLength=true:alignmentOnTruncation=right}|${message}"
};

// Rules for mapping loggers to targets
config.AddRule(NLog.LogLevel.Trace, NLog.LogLevel.Fatal, logTrace);

loggingBuilder.AddNLog(config);
});
}

var appServices = new ServiceCollection();
var testServices = new ServiceCollection();
RegisterLogging(appServices, "APP");

RegisterLogging(testServices, "TEST");
var appProvider = appServices.BuildServiceProvider();
var testProvider = testServices.BuildServiceProvider();


var logtest = testProvider.GetRequiredService<ILogger<NLogTest>>();
logtest.LogInformation("Test logger");
var logApp = appProvider.GetRequiredService<ILogger<NLogTest>>();
logApp.LogInformation("App logger");

}
}


Thanks
Remco
#2 Posted : Tuesday, March 17, 2020 8:40:34 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Hi, thanks for posting.

We don't have anything in NCrunch that integrates with NLog, and all log/trace capture is directly piped and not manipulated. My guess would be that it's using the name of the task runner process and just sticking it in the log.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.030 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download