Writing Order Log Entries to Separate Log File

Follow

Sometimes the order-related entries can get lost in the main log file. Luckily, Sitecore makes it easy to pull these out into a separate log file - similar to Sitecore's built-in Search, Crawling, Publishing log files.

In your web.config, under the <log4net> node, add a new <appender>:

<appender name="OrdersLogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging">
<file value="$(dataFolder)/logs/Orders.log.{date}.txt" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n" />
</layout>
<encoding value="utf-8" />
</appender>

Then add the accompanying <logger>:

<logger name="ActiveCommerce.Orders" additivity="false">
<level value="INFO" />
<appender-ref ref="OrdersLogFileAppender" />
</logger>

This will result in all order-related log entries being written to the new "Orders.log.{date}.txt" file.

Note, for older versions of Active Commerce, you'll want to also add a <logger> for "ActiveCommerce.OrderProcessing" namespace.

 

Have more questions? Submit a request

Comments