Log request related information


We would like to know if there is a way to log request information such as requestor, request url, etc. using ServiceStack’s logging abstraction, specifically NLog.

Currently, the layout property of our nlog.config file looks like this:


However, ${aspnet-request:serverVariable=remote_addr} and ${aspnet-user-identity} are always empty.


I wouldn’t use ServiceStack Logging abstraction in ASP .NET Core as NLog is only going to have ASP .NET Core logging configuration binding with Microsoft’s logging abstractions, so I’d stick to configuring NLog with Microsoft’s Logging Abstraction.

If you’re using ServiceStack Auth I wouldn’t expect ${aspnet-user-identity} to return anything, you’d instead be able to get the User Id with IRequest.GetSession().UserAuthId.

1 Like