0
votes

We are hosting sitecore 8.1 in azure web apps. We log the errors on to App Dynamic where the application ticket will auto-created for each error.

The problem is that 90% of errors are raised by builtin sitecore piepelines e.g. GeoIP service not setup, session end not setup (due to MongoDB) etc.

Is it possible to identify and filter out the errors raised by built in pipelines and events in Sitecore?

Thanks.

3
Why don't you fix the errors? Lookup GeoIP can be switched off for example!MaksymD

3 Answers

0
votes

Sitecore uses Log4Net as a framework for its logging. I haven't done it myself but I'd bet you can use standard L4N techniques to filter messages. It's probably just a config tweak or two.

You might prefer instead to spend the same time and research effort correcting the issues in Sitecore? Most services can be disabled if you aren't using them (and if they are raising errors then they aren't working anyway, right). Remove items from pipelines, disable tracking.

This way not only will you see fewer errors in your logs, your site will go faster as well!

0
votes

If you only want the log files to log errors in the system, you need to set your logging level to ERROR in the log4net setup.

  <log4net>
    <!-- The appenders will go here -->
    <root>
      <priority value="ERROR" />
      <appender-ref ref="LogFileAppender" />
    </root>
    <logger name="Sitecore.Diagnostics.WebDAV" additivity="false">
      <level value="ERROR" />
      <appender-ref ref="WebDAVLogFileAppender" />
    </logger>
    <logger name="Sitecore.Diagnostics.Search" additivity="false">
      <level value="ERROR" />
      <appender-ref ref="SearchLogFileAppender" />
    </logger>
    <logger name="Sitecore.Diagnostics.Crawling" additivity="false">
      <level value="ERROR" />
      <appender-ref ref="CrawlingLogFileAppender" />
    </logger>
    <logger name="Sitecore.Diagnostics.Publishing" additivity="false">
      <level value="ERROR" />
      <appender-ref ref="PublishingLogFileAppender" />
    </logger>
    <logger name="Sitecore.FXM.Diagnostics" additivity="false">
      <level value="ERROR" />
      <appender-ref ref="FxmLogFileAppender" />
    </logger>
  </log4net>

If you want to disable a particular log file, set the level value to NONE.

Bare in mind tho, setting the level to ERROR will stop all info and warning entries from being logged, so you may miss important entries for debugging issues.

0
votes

You can just use the default Log4net and write to the same log file that sitecore uses, you dont even need to modify the webconfig to do this. It will be something like this:

Sitecore.Diagnostics.Log.Error(

Once you type this you'll see the different options you have to construct the log error. For identifying the type and where it came from you can check the exception type and stack and go from there, in this case you should create a global exception handling class and pull all the exception in there and run them through your identification/categorization methods!

Make sure you reference this 2:

using log4net;
using Sitecore.Diagnostics;