Surendra Sharma

Surendra Sharma

Search This Blog

Tuesday, March 28, 2017

How to change log level of Sitecore log files



On one of our Sitecore hosted server, log files sizes are growing rapidly. We are fine with few MB, but some of our search logs are growing more than 300 MB as shown below

Logs file in Data\logs folder
Logs file in Data\logs folder

Instead of logging everything, we want to log only error messages to reduce the file sizes.

How to achieve it?

Open your Sitecore web.config file.

Find “<log4net>” and locate logger section for “SearchLogFileAppender

Change its level from INFO to ERROR as

    <logger name="Sitecore.Diagnostics.Search" additivity="false">
      <level value="ERROR"/>
      <appender-ref ref="SearchLogFileAppender"/>
    </logger>

Now your search log should only record searching related errors.

In same way, you can also change log level for Crawling, WebDAV, publishing and Sitecore logs files.

I hope you like this Sitecore trick. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this trick if it’s useful for you.

Friday, March 24, 2017

Sitecore Habitat : what to do if 05-Sync-Unicorn is not working



I have just started to play with Sitecore Habitat project. The first problem that I encounter is Habitat setup.
 

Everything worked fine except task “05-Sync-Unicorn”. I waited for an hour to complete it but it seems to showing in progress status as 

Sync Unicorn
Sync Unicorn

I googled for the solution but didn’t find any suitable link which explained it properly. So I decided to write the article

Follow below steps if "05-Sync-Unicorn" is not working for you


  • Login to Sitecore desktop

  • Open http://yourinstance/unicorn.aspx
 
Unicorn Sync Page
Unicorn Sync Page



  • You can sync Sitecore items by clicking "Sync" button for each component one by one

  1. Syncing process updates items in Master, core, link database and in search indexes.
  2. It also sync roles, users
  3. Finally it published all synced items to web
Sync Progress
Sync Progress

  • Run "06-Deploy-Transforms" from Visual Studio

Deploy Transforms
Deploy Transforms
 
  •  Open your instance on browser and hurreyyy you will get your Habitat site

Habitat Home Page
Habitat Home Page
 

I hope you like this Sitecore trick. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this trick if it’s useful for you.

Exception in UrlAgent url: /sitecore/service/keepalive.aspx

We notice below error in our project log files on CD server as 
 
ManagedPoolThread #15 00:23:21 INFO  Job started: Sitecore.Tasks.UrlAgent
ManagedPoolThread #15 00:23:21 INFO  Scheduling.UrlAgent started. Url: http://www.sitecorelessons.com/sitecore/service/keepalive.aspx
ManagedPoolThread #15 00:23:21 ERROR Exception in UrlAgent (url: /sitecore/service/keepalive.aspx)
Exception: System.Net.WebException
Message: The remote server returned an error: (401) Unauthorized.
Source: System
   at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
   at System.Net.WebClient.DownloadData(Uri address)
   at Sitecore.Web.WebUtil.ExecuteWebPage(String url, NameValueCollection headers)
   at Sitecore.Tasks.UrlAgent.Run()
ManagedPoolThread #15 00:23:21 INFO  Job ended: Sitecore.Tasks.UrlAgent (units processed: )

What’s the root cause and how to fix this error?

Solution:

Problem was that Anonymous access permission was denied on server for Sitecore folder.

It’s a good practice to remove access permissions from Sitecore folder on CD server.

However to fix this issue either we have to provide access permission to Service folder or keep its files on some other location and then change config files entries according to that new path.

We can provide access permission to service folder as

  • Open IIS
  • Navigate to Service folder of your website and open Authentication as
 
Folder Authentication
Folder Authentication

  • Select Anonymous Authentication and Enable its status as
 
Enable Anonymous Authentication
Enable Anonymous Authentication

That's it.

We didn’t find any new error in log files after allowing permission to Service folder.

After fixing this, we are now receiving proper log as

ManagedPoolThread #6 02:12:23 INFO  Job started: Sitecore.Tasks.UrlAgent
ManagedPoolThread #6 02:12:23 INFO  Scheduling.UrlAgent started. Url: http://www.sitecorelessons.com/sitecore/service/keepalive.aspx
ManagedPoolThread #6 02:12:23 INFO  Scheduling.UrlAgent done (received: 561 bytes)
ManagedPoolThread #6 02:12:23 INFO  Job ended: Sitecore.Tasks.UrlAgent (units processed: )

I hope you like this Sitecore tip. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this script if it’s useful for you.