NicholasNoise commented on pull request #72:
URL: https://github.com/apache/logging-log4net/pull/72#issuecomment-746338377


   @fluffynuts 
   I've used custom `PatternConverter`:
   ```csharp
           /// <inheritdoc />
           protected override void Convert(TextWriter writer, object state)
           {
               if (writer == null)
                   throw new ArgumentNullException(nameof(writer));
   
               string uri = GetUri();
               writer.Write(uri);
           }
   
           private static string GetUri()
           {
   #if NETFRAMEWORK
               try
               {
                   var request = HttpContext.Current?.Request;
                   return request?.Url.AbsoluteUri;
               }
               catch (Exception)
               {
                   return null;
               }
   #elif NETSTANDARD
               return null;
   #endif
           }
   ```
   But now I'm not able to use it, cuz there are no static `HttpContext` for 
netstandard2.0 \ netcoreapp, so we need to inject `IHttpContextAccessor` to 
support this feature.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to