You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.
Please describe the current behavior?
In the following scenario, the log in elastic has the log message but no exception whereas the same log written to file contains the full exception details.
try
{
...
}
catch (Exception ex)
{
logger.Error(ex, "Error doing some stuff: {xyz}", xyz);
...do some handling stuff
}
I have noticed in a different project of the same solution (same versions of serilog packages and target framework) that the following scenario resulted in the log in elastic being as expected...
catch (Exception ex)
{
var exMessage = ex.Message;
logger.Error(ex, " Some error - [exMessage: {exMessage}]", exMessage);
throw;
}
and the log entry contained
"exceptions": [
{
"Depth": 0,
"ClassName": "System.ServiceModel.FaultException",
"Message": "Server was unable to process request. ---> Exception has been thrown by the target of an
...
Please describe the expected behavior?
Log in elastic should contain exception
If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem
This is our logging config
public static void StartLogger()
{
SetEnvironmentName();
//Change TLS version to support elasticsearch
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
Log.Logger = new LoggerConfiguration()
.WriteTo.File(FilePattern, rollingInterval: RollingInterval.Day)
.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(ElasticSearchUrl))
{
AutoRegisterTemplate = false,
//AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7,
IndexFormat = string.Format("{0}{1}", ElasticSearchIndex, "-{0:yyyy.MM.dd}"),
ModifyConnectionSettings = x => x.BasicAuthentication(ElasticSearchUser, ElasticSearchPassword),
TypeName = null
})
.MinimumLevel.Is(SerilogMinimumLevel)
.Enrich.WithProperty("Application", AppName)
.Enrich.WithProperty("RequestId", Guid.NewGuid())
.Enrich.WithEnvironmentName()
.Enrich.WithMachineName()
.Enrich.FromLogContext()
.CreateLogger();
Log.Information("App up");
}
The text was updated successfully, but these errors were encountered:
A few questions before you begin:
Does this issue relate to a new feature or an existing bug?
What version of Serilog.Sinks.Elasticsearch is affected? Please list the related NuGet package.
8.4.1
What is the target framework and operating system? See target frameworks & net standard matrix.
Please describe the current behavior?
In the following scenario, the log in elastic has the log message but no exception whereas the same log written to file contains the full exception details.
I have noticed in a different project of the same solution (same versions of serilog packages and target framework) that the following scenario resulted in the log in elastic being as expected...
and the log entry contained
Please describe the expected behavior?
Log in elastic should contain exception
If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem
This is our logging config
The text was updated successfully, but these errors were encountered: