Showing posts from July, 2020

Adding usernames and urls to the Sitecore default Log files

When troubleshooting issues, the log files become one of our best allies, however, sometimes the information we get is not enough to clearly pinpoint the issue. Therefore, adding some additional information to the errors can be beneficial. In this post, I will show how you can create a custom LogFileAppender to use instead of the default one used with an OOTB Sitecore 9.1 installation.

First, let's check how the default LogFileAppender is configured in a Sitecore 9.1 instance. If we check the Sitecore.config we'll see something like this: 

<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender, Sitecore.Logging"> <file value="$(dataFolder)/logs/log.{date}.{time}.txt" /> <appendToFile value="true" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="-1" /> <maximumFileSize value="10MB" /> <…