Monday, August 31, 2015

Sitecore logs - How to find errors and issues

Environment - Sitecore 8.0 rev. 150621

Hi all,

If you worked as a pure .NET developer and you moved to work with Sitecore you will get the same problems as I had few months back from now.

"How am I going debug this ???"
"Where are the errors ??"
"How can I find the errors on my site and any function ???"

Those are my questions when I start Sitecore. Since Sitecore is a product and it uses it's own dll files to perform it's internal tasks we can't debug the classes inside the Sitecore like we do in a pure .Net project. But Sitecore provide a way to take you out from these troubles. Sitecore log files.
You can find these log files on your data_folder/App_Data/Sitecore/logs

Sitecore uses Apache's log4net to create log files. You can have a read on log4net from here.

There are 3 types of log files

1. Standard log (log)
This is the most common log. This log will log errors, warnings, information, etc according to your settings.

            Verbose log
This logging feature is disabled by default. This feature is designed to provide search index configuration and provide more rich and more detailed version of the problem. You can enabled this feature by removing the '.example' from the 'Sitecore.ContentSearch.VerboseLogging.config.example' cofig files inside the {your_site_folder}/App_Config/Include

* Verbose Log should enable only on special scenarios and never run long period of time specially on production environments. Since verbose logger would creates an extremely large log file, it can cause to a performance issue.

2. Crawling log (Crawling.log)
Track information about indexing operations. (I'll talk about Sitecore Indexing in latter session)

Following shows an example of  a crawling log.

11704 13:22:13 INFO  [Index=social_messages_web] Initializing SitecoreItemCrawler. DB:web / Root:/sitecore/social/Messages
11704 13:22:13 INFO  [Index=sitecore_analytics_index] Initializing TimedIndexStrategy with interval '00:01:00'.
11704 13:22:13 INFO  [Index=sitecore_core_index] Initializing IntervalAsynchronousUpdateStrategy with interval '00:01:00'.
11704 13:22:13 INFO  [Index=sitecore_master_index] Initializing SynchronousStrategy.
11704 13:22:13 INFO  [Index=sitecore_web_index] Initializing OnPublishEndAsynchronousStrategy.
11704 13:22:13 FATAL [Index=sitecore_web_index] Initialization of OnPublishEndAsynchronousStrategy failed because event queue is not enabled.

By default the Crawling log is set to output logs on 'INFO' level.

3. Search log (Search.log)
Shows queries that were generated and run.

Following shows an example for a search log.

3724 13:47:58 INFO  ExecuteQueryAgainstLucene (sitecore_analytics_index): type:contact - Filter :
3724 13:47:58 INFO  ExecuteQueryAgainstLucene (sitecore_analytics_index): type:contact - Filter :
3724 13:47:58 INFO  ExecuteQueryAgainstLucene (sitecore_analytics_index): +contact.contactid:a2a2d13f8603400d864c7914aadd593d +type:visit - Filter :

To get the full level details of the content search you have to enable the 'Sitecore.ContentSearch.config' and change the logging level to 'DEBUG'.

You can find all the configurations related to these log files in the <log4net> section of the web.config file.
According to the requirement you can increase or decrease the level of the log. The following provides the logging levels minimum to high.

  1. OFF - nothing gets logged 
  2. FATAL
  3. ERROR
  4. WARN
  5. INFO
  6. DEBUG
  7. ALL - everything gets logged

* Your log levels can be changed when you enabled the Verbose logging.

Sitecore will create logs for each day. If you want fresh logs on a day, you can restart the site from Microsoft IIS Manager. Then Sitecore will create logs with date and number. (ex- log.20150828.132211.txt)

* If you are still like to see the .Net errors on the page when you are testing you can turn off the custom errors on the web.config file.

Change <customErrors mode="On"  /> to <customErrors mode="Off"  />




Tuesday, August 18, 2015

Sitecore Web Forms for Marketers Save Actions: The action does not exist

Environment - Sitecore 8.0 rev. 150621

Sitecore Web Forms for Marketers Save Actions are used to provide functionalities which need to perform when a certain form is getting submitted.


When dealing with the save actions on Sitecore 8 there is an issue with the graphical interface on save action management. Therefore some save action which removed from the form can be still exist in the save actions raw values.
You can find this by checking on the Sitecore log files. If there is a such issue, in the Sitecore logs you can find a error similar bellow.

6092 05:46:44 WARN  Web Forms for Marketers : The '{D866FC78-08F5-4AAA-975C-26E991B1D881}' action does not exist

Follow these steps to find this save action exists.

1. Go to your Sitecore instance and go to Web Forms for Marketers, go to the form which throwing the error and turn on the 'Raw values' from the 'view' tab


2. Copy the value (xml) of the 'Save Actions' field of the 'Submit' section to a notepad.

3. Copy the Sitecore item. (according to the log message the item is - {D866FC78-08F5-4AAA-975C-26E991B1D881})

4. Find the copied Sitecore item on the notepad.
    If the item is found on the notepad you have to remove it from that xml.

    Remove unwanted save action from xml.

    4.1. Create a new form.
    4.2. Add the other save actions on your form to the newly created form.
    4.3. Copy the value (xml) of the 'Save Actions' field of the 'Submit' section of the newly created form.
    4.4. Paste it to the 'Save Actions' field of the 'Submit' section form that throwing errors.
    4.5. Do the required changes to the save actions.