Daily Usage Issues

nCrunch.TaskRunner.DotNetCore.20.x64 Information prefix for trace output?

Started by GreenMoose on 1,906 views

[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?


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


Complete test code:

[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
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.

Edited

Post a reply

Log in to reply.