Added new parameter in log "Origin"

This commit is contained in:
ashutosh.nehete 2025-07-09 15:11:08 +05:30
parent 669500e57e
commit ff722503d5
2 changed files with 4 additions and 2 deletions

View File

@ -24,7 +24,7 @@ namespace MarcoBMS.Services.Middleware
var response = context.Response;
var request = context.Request;
var tenantId = context.User.FindFirst("TenantId")?.Value;
string origin = request.Headers["Origin"].FirstOrDefault() ?? "";
using (LogContext.PushProperty("TenantId", tenantId))
using (LogContext.PushProperty("TraceId", context.TraceIdentifier))
@ -33,6 +33,8 @@ namespace MarcoBMS.Services.Middleware
using (LogContext.PushProperty("Timestamp", DateTime.UtcNow))
using (LogContext.PushProperty("IpAddress", context.Connection.RemoteIpAddress?.ToString()))
using (LogContext.PushProperty("RequestPath", request.Path))
using (LogContext.PushProperty("Origin", origin))
try

View File

@ -218,7 +218,7 @@ namespace MarcoBMS.Services.Service
catch (Exception ex)
{
// Token is invalid
Console.WriteLine($"Token validation failed: {ex.Message}");
_logger.LogError($"Token validation failed: {ex.Message}");
return null;
}
}