Wednesday, 13 June 2012

Sitecore logviewing made easy with log2console

Today i saw this tweet from @kiranpatils
My new  shared source module -- SCLogExplorer -- easier and faster way to analyze  log files --
 And that make me think I should share the tool I am using, when I am developing.


Log2Console is using the different logging library's ability to log over TCP or UDP.

Sitecore is using log4net as logging engine, where there are implemented UDP and TCP appenders (Link).

It can filter on different loggers, so you can filter out any loggers you don't want, eg. Sitecore Diagnostics, analytics and more.

Log2Console can also search in the log, and filter on what level off logging you want to see

How to setup a UDP receiver 

In log2console, there is a button on the top, named receivers.
In that window, press add, and pick UUDP (IP v4 and v6)

Now you have added a receiver, and can configure that receiver.
Just leave it as default, and pick up the configuration from the sample configuration.

How to configure Sitecore

Open up the web.config from the Sitecore solution you want to receive logs from.

Find the log4net section.
And insert the sample configuration, like i have done in the code below, between the log2console comments
One thing you need to modify, is the remote address it sends log messages to. 
Change it to, because at some reason localhost ain't working.
You also need to setup a logger to use the appender you just inserted.
I'm using root, so I will receive everything.
Now launch the browser, and start up the website, and see log messages 


One more thing

You don't want this to be in production. 
If you like me, using config transform from msbuild package pipeline, you can insert this code snippet in your web.config transform file.

I hope you like this little tutorial on how to use log2console, it has a lot more features that i haven't used, so if you find somthing good, let the community know about it.

Oh and one thing i hate with the original Log2Console, is using windows 7's way to show progress state, to show that there is log messages coming in - So i made a fork making that an option. 


  1. wonderful information, I had come to know about your blog from my friend nandu , hyderabad,i have read atleast 7 posts of yours by now, and let me tell you, your website gives the best and the most interesting information. This is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new posts, once again hats off to you! Thanks a ton once again,
    Regards, sitecore training in hyderabad

  2. I have been reading out a lot of your articles.
    I will certainly bookmark your Blog.
    Hybris Training
    Devops Training

  3. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai