0
sanliotrade created
Is there a way to add the TenantId on log pattern?
Log4net has custom properties, but where to set the custom property on asp.net zero? (.net core + angular)
log4net.ThreadContext.Properties[ "tenantId" ] = _abpSession.TenantId;
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
2 Answer(s)
-
1
Can use asp net core middleware.
<conversionPattern value="%property{tenantid} %-5level %date [%-5.5thread] %-40.40logger - %message%newline" />app.UseAbp(); // Initializes ABP framework. app.Use(async (context, next) => { log4net.ThreadContext.Properties["tenantid"] = context.RequestServices.GetRequiredService<IAbpSession>().TenantId.ToString(); await next.Invoke(); });1 INFO 2019-11-28 13:26:43,808 [9 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished in 80.043ms 200 application/x-javascriptMarkdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Thank you!!
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)