Friday, July 20, 2012

ASP.Net - How to Log Debug Information


The System.Diagnostics namespace provides a lot of tools for debugging. In this set, the most simple and frequently used tool is Debug.Write or Debug.WriteLine. These methods are used to print some text on the output window for debugging purpose.

Since Visual Studio provides a lot of rich debugging tools, it seems that people are not doing much experiment on this namespace. However, in some situations - especially on the production environment, I believe the System.Diagnostics is the best one to go with.

Just write the stuffs into Debug.Write or Debug.WriteLine where required and place the following into your Web.config file.

<system.diagnostics>
    <trace autoflush="true" indentsize="4">
      <listeners>
        <add name="textListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="./Debug.log" />
      </listeners>
    </trace>
</system.diagnostics>

WoW!!! we are done with it. Its time to run the application and check the log now.

You can find the file Debug.log on the root of your project(of-course you can change the location  just by specifying it on initializeData attribute of the listeners configuration).

Well, this is not the only way to trace, track  or debug the application on production environment. But this is a simple approach that I have come across with.

If you would like to know more about this. Please refer the below links:
  1. Integrating ASP.NET Tracing with System.Diagnostics Tracing
  2. Configuring Tracing

Thursday, July 5, 2012

Chrome Extension - Translator - Version 1.1.x

Two weeks ago I published my first extension for chrome called Translator, which I was created just for fun. But the increasing number of users encouraged me to improve the functionality and create a new version 1.1.x(well, as of now just a subversion) in such a short time.

If you are already using the extension, the chrome will take care of the update; otherwise you can install or add it to your browser from here.


This sub version contains a feature called In-line Translation. 


If you checked the check-box In-line Translation on the popup, a bar will be appeared on the top of your page. This enables you to translate the texts as you select it on the page. 


Isn't it crazy?.......yes of-course; most of us have the habit of selecting the text while reading something on the web, which causes the extension to translate them. Hence I didn't provided the option to enable this feature permanently. Also, I request you to use this feature only, if absolutely necessary as it increases the load on Google's Translation server.

Again, if you like it - Use, Rate and Share.