-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
NLog prepends unspecified data to Trace target. #1968
Comments
After playing with Trace it appears the data being prepended in the issue above is caused from a call to
Is there something that could be done to remove the prepended data? |
so this is a feature of The current code is: protected override void Write(LogEventInfo logEvent)
{
if (logEvent.Level <= LogLevel.Debug)
{
Trace.WriteLine(this.Layout.Render(logEvent));
}
else if (logEvent.Level == LogLevel.Info)
{
Trace.TraceInformation(this.Layout.Render(logEvent));
}
else if (logEvent.Level == LogLevel.Warn)
{
Trace.TraceWarning(this.Layout.Render(logEvent));
}
else if (logEvent.Level == LogLevel.Error)
{
Trace.TraceError(this.Layout.Render(logEvent));
}
else if (logEvent.Level >= LogLevel.Fatal)
{
Trace.Fail(this.Layout.Render(logEvent));
}
else
{
Trace.WriteLine(this.Layout.Render(logEvent));
}
} It should be |
you could create your own trace target:
|
Yes this is a feature of Trace unfortunately. Thank you for the example! I think that is what I will have to do. |
another option is to add an option to the TraceTarget: UseAlwaysWriteLine PR accepted ;) |
Type: Bug
NLog version: 4.4.0
Platform: .Net 4.6
Current NLog config (xml or C#, if relevant)
In case of a BUG:
Yes it appeared to be working correctly
This is not an exception but logs from the nlog-internal.log
not that I am aware of
I haven't tried yet.
Not sure how to write a unit test, sorry.
in case of a FEATURE REQUEST:
A user should be allowed to configure the default log messages to how they would like them to appear.
The text was updated successfully, but these errors were encountered: