-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Combine output template with log4j/log4net formatter #179
Comments
Hi there and welcome to this repository! A maintainer will be with you shortly, but first and foremost I would like to thank you for taking the time to report this issue. Quality is of the highest priority for us, and we would never release anything with known defects. We aim to do our best but unfortunately you are here because you encountered something we didn't expect. Lets see if we can figure out what went wrong and provide a remedy for it. |
Thanks for the suggestion and sorry for the late reply. |
I've seen message templates used for non-structured log events, e.g. Serilog.Sinks.Console, but I haven't seen them used yet for structured log events. If you find a sink that features this combination, preferably by the author of Serilog, please let me know and I'll take a look at it. |
Hi there. I'm certainly not an expert. I've used about 5 sinks so far in my projects. |
I think the option we currently have is to take inspiration from one of the existing text formatters (found here), and adapt it to your needs. Please let me know if you encounter any problems with the adaptation. |
Problem
There doesn't seem to be a way to combine
log4j
/log4net
formatters with a template.The
Udp
extension that accepts a template usesMessageTemplateTextFormatter
directly and doesn't produce an XML message.Feature request
It would be helpful if we extended both
log4j
/log4net
formatters to accept a template and use it to enhance thelog4j:message
according to it.Proposed solution
We can add an optional
outputTemplate
in bothLog4jTextFormatter
andLog4netTextFormatter
constructors, and then use Serilog'sMessageTemplateTextFormatter
internally to produce the message attribute, while keeping the rest as isThe text was updated successfully, but these errors were encountered: