How to capture URL and IP address using NLog on error

How do I capture items from request object using NLog.
In my NLog.Config there are options like {aspnet-request:serverVariable=HTTP_URL} from NLog.Web but I would assume there is an equivalent option for Servicestack implementation of the logger.


The trick for me was to load the NLog.Web Assembly. It is not loading automatically even though NLog says it should.

Before loading ServiceStack in my Global.asax od this:

 var logFactory = ConfigurationItemFactory.Default;

You can only access the HTTP Request context in App Hosts that provide singleton access like ASP.NET where you can access HttpContext.Current.Request. We’ve encapsulated this behind the HostContext.TryGetCurrentRequest() for App Host’s that support access by singleton.