Hi Jeroen,
no, it doesn't work with the $ as well. Like I said, Epi loggerExtensions doesn't support that kind of message template.
The message is a string, so it supports interpolated strings as well. I use them all the time
Hi Jeroen,
do you mean in EPI and with _logger.Information for example?
Because when I try this it for example:
_logger.Information($"{Test}", "123");
it gives compilation error saying "Cannot resolve symbol Test".
My purpose here is to have events/fields/properties logged differently for visualization in Kibana.
Thanks for the help, I appreciate it.
in this case {Test} should be a variable, or a property of an object you have, or ... So you will probably get that compilation error because 'Test' is not available
An example from Quicksilver:
_logger.Information($"Cart '{cart.Name}' for user '{cart.CustomerId}' is being deleted.");
Yeah, but what I want is a placeholder, not a variable.
If you have time you can check "structured logging" or event logging.
That's more or less what I'm talking about.
You could create your own enricher for the things you need, if that's an option
For sites that use Application Insights (whether Episerver DXC or not), here is an article with a small demonstration. It is about logging and tracing (metadata and metrics) with Application Insights.
Hi,
I have a log setup in EpiServer using EPi.Libraries.Logging.Serilog and I was trying to integrate it with Logstash / ElasticSearch and Kibana. But unfortunately the ILogger interface provided by Epi (EPiServer.Logging) doesn't support the use of placeholders in the lLog method, and therefore the LoggerExtensions class (EPiServer.Logging.LoggerExtensions) doesn't support the placeholders in the logging methods (information, error, etc).
By Placeholders I mean:
_logger.Information("This is a {test}", "my input to logstash").
It doesn't support '{test}' , which would make me have fields/properties in the generated json sent to logstash.
Any ideas of workaround or any implementation that could make this work?
Thanks in advance!