Custom LayoutRenderers (lambda) and properties
LarsWesselius opened this issue · 4 comments
Right now, when using properties as described in the readme.md you can use layout renderers as long as they're available by adding them as an extension (I believe). I'm however using the LayoutRenderer.Register lambda, which fails the initialization of the Seq target if I use that layout renderer because it hasn't been registered yet when NLog initializes itself and the target.
Could a solution be allowing adding properties to the SeqTarget Properties member? Right now that's not possible because of the private setter. Any other ideas?
Hi Lars, thanks very much for sharing your thoughts.
Though the Properties
member is read-only, you should be able to invoke Add()
on it, e.g. target.Properties.Add(...)
- does this work for your use case?
Best regards,
Nick
Nick,
I totally got that wrong, I'm sorry. Of course I can just use Add, I feel stupid now. Sorry and thanks :)
No trouble at all! I was glad to hear someone is giving the new alpha a try - it'd be great to hear how it goes for you if you can share any experiences. Thanks again!
Will do. Came at a perfect time for us as we were already using NLog but wanted to start using Seq as well and benefit from the structured logging. We were considering switching to Serilog but then this + Nlog 4.5 alpha came round.