-
Notifications
You must be signed in to change notification settings - Fork 165
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
Add a layout renderer for correlation ID #328
Comments
There is already something called |
|
What if I implement |
is this for full .net or .net core? |
Must admit my skills in ASP.NET MVC + Core are weak. So I have a hard time knowing how to lookup the different ids:
See also here aspnet/Hosting#1394 |
@304NotModified This is for full .net |
OK, if we don't need more dependencies, then NLog package is OK for this. If not, then we need a NLog.WebApi or something like that. I have to admit I don't have much time to setup a new package (and unfortunately it always takes more time then it should be) |
@304NotModified so do you agree with implementing |
@304NotModified Looks like we will need dependency on Microsoft.AspNet.WebApi.Core nuget package |
OK, then the layout renderer could be |
Yes, but we will need a new project in the solution and new nuget package so that we don't introduce new dependency for NLog.web users |
The specification of ´GetCorrelationId` :
So it sounds like the Where it attempts 3 lookups:
If fallback is required then the fallback Guid is stored using Because there is no HttpRequestMessage (and building one from HttpContextBase will have a huge overhead and will not be the same, and will have empty Properties-dictionary). Then I suggest the following: https://github.com/NLog/NLog/wiki/Trace-Activity-Id-Layout-Renderer |
Yes, I currently use ${activityid} as a workaround to log correlation id |
@304NotModified Are you ok with adding a new nuget package for this layout renderer or do you think using ${activityid} as a workaround is enough? |
@Giorgi I'm curious if GetCorrelationId works when used from HttpRequestBase. I have my doubts. |
|
@Giorgi That lookup will only work if some other code has already injected HttpRequestMessage into the HttpRequestBase.Items-dictionary. Again not a ASP.NET wizard so maybe HttpRequestBase is always created together with an HttpRequestMessage-object (which are connected). I know Microsoft libraries loves to execute unnecessary code to help Intel sell more CPUs, but sometimes there are surprises. |
@snakefoot So what do you suggest? |
I just suggested that some investigation should be done. Again not an expert in traceid handling in Asp Net Mvc. Maybe some one else has a good idea? What is wrong with Trace.CorrelationManager.ActivityId ?
|
@Giorgi Found this random code from the JsNLog-library:
Maybe this can be used to implement |
Type (choose one):
In case of a FEATURE REQUEST:
Should I send a PR ?
The text was updated successfully, but these errors were encountered: