Replies: 7 comments
-
You should be able to, but you shouldn't need to use the layout. you do need to set See PR #10 |
Beta Was this translation helpful? Give feedback.
-
But I have tried I guess, I could inherit If you have any better ideas, let me know. |
Beta Was this translation helpful? Give feedback.
-
Here is what I did and it works:
Then, I use this target, instead of the default one. |
Beta Was this translation helpful? Give feedback.
-
You'd specify the properties you want sent to graylog in the config like this
then use the structured logging to provide the data.
https://github.com/NLog/NLog/wiki/How-to-use-structured-logging Which is effectively the same thing as setting the property, but also interpolates it into the message. |
Beta Was this translation helpful? Give feedback.
-
Your solution for global parameters is great, Missed that part. But yes each log message does need the params attached somehow. Serilog has enrichers which work the way you want but I'm not sure NLog has an equivalent. |
Beta Was this translation helpful? Give feedback.
-
another alternative if the values are static
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the responses. :) |
Beta Was this translation helpful? Give feedback.
-
The
GraylogHttpTarget
class contains aLayout
property.Any chance I can use it to render some extra properties automatically, instead of manually doing this? :
I tried to use the Layout property, but I don't think it works.
Essentially, what I want is this code:
...to log some extra properties using a layout (without modifications to the code above).
Not sure if there is a good way to transform a layout into the properties of
LogEventInfo
and supply them behind the scenes.Beta Was this translation helpful? Give feedback.
All reactions