Salesforce Summer 16 – My favorite top 20 features

List of Salesforce Summer 16 features

Summer 16 is already in production and most of you already knows what’s there in pandora box. In this post, I will share my favorite 20 features of Summer 16 release.

Salesforce Summer 16
Salesforce Summer 16

1. Clone Sandbox (Pilot) : This feature is not yet generally available however worth mentioning. Till now, we could create Sandbox only from production, however Summer 16 gives us a way to create brand new sandbox from other existing sandbox instead of production.

2. New Trace Flags in Debug Log : Now we can add trace flags on Automated Process, User, Apex Trigger and Apex classes as well. Before this release, we could only add trace flag on user. This enhancement will give developers more control over what to display in debug log and overcome debug log size limit problems.

Salesforce Summer 16 new Debug logs

Continue reading “Salesforce Summer 16 – My favorite top 20 features”

Advance Apex debugging in Salesforce and best practices – Videos

How to resolve apex debug log size limit issue, Difference between Eclipse and developer console, Interactive Apex Debugging, Keyboard shortcuts for Developer console and Other best practices

While developing applications on platform using Apex, I am sure you may have been in need of debugging your code. Salesforce being cloud platform, method to debug code is very different as compared to other programming languages. In this post we will discuss all about Apex code debugging, challenges, solutions and other best practices.

Salesforce Advance Apex debugging
Salesforce Advance Apex debugging

How many ways to debug Apex code

  1. Eclipse IDE
  2. Debug log
  3. Developer console
  4. Fetch debug log using Tooling API

Continue reading “Advance Apex debugging in Salesforce and best practices – Videos”

Getting started with Apex debug logs in salesforce

Introduction to debug logs in salesforce with step by step procedure and screenshot, Difference between Debug log and System log in Salesforce

For the newbie and intermediate developers, most of the time it becomes very necessary to log the program at some stage / line and look into those that what actually is happening with the code.

In salesforce it is very easy to log and track the apex program. To log the apex code use below line of code:

System.debug(“Your message”);
System.debug(Logginglevel,”Your Message”);

Log levels available in Apex are (listed from lowest to highest) :

  • WARN
  • INFO
  • FINE

Continue reading “Getting started with Apex debug logs in salesforce”

Tracing ASP.NET Website

Author posted by Jitendra on Posted on under category Categories ASP.NET and tagged as Tags , , with 1 Comment on Tracing ASP.NET Website

Demonstrates that how to Trace ASP.NET web applications

In ASP.NET there two types of Tracing

  • Application Level
  • Page Level

Page level Tracing takes the precedence over the Application Level tracing.

Lets start with creating new website.

In web.config add following entries to enable Application level tracing below System.web element.



pageOutput=”true” – add the tracing information at the bottom of the ASPX page.

localOnly=”false” – tracing will be available to any web page.

requestLimit=”10″ – How many request should be saved on the server.

mostRecent=”true” – whether or not display the recent tracing information if the request reach at the limit.

After adding above tag in web.config, the output of ASP.NET page will look like:

ASP.NET Tracing Output

Here you can see much of informations displayed like SessionId, Request Status, Controls available on that page,  All the events of the page with start and end time etc and thus you can figure out the performance of your web application.

No Trace for a particular Page

Create a web page and in aspx file and at header write the tag Trace=”false”

Create few controls like link button and view the page in browser. You will see that the page is displayed with no tracing information, although its turned ON in web.config but page level tracing has the precedence over application level tracing.

Writing Custom Trace Information

Now on the click event of Link buttons write the custom trace information.

protected void lblwriteMessage_Click(object sender, EventArgs e)
	Trace.Write("Custome Message", "Write Link Button clicked");
protected void lblwarnMessage_Click(object sender, EventArgs e)
	Trace.Warn("Custome Message", "Warn Link Button clicked");

when you will click on the WriteLink button, below output will be seen.


and when you will click on warn button, the message will be displayed in Red color. so it is suggested to display the the important trace message as a warn.


Page.Trace Vs System.Diagnostics.Trace

Create a new class file and write a static function which will write the Trace Message. You will notice that Trace object is not available by default like ASPX page instead you will need to import the package “System.Diagnostics”.

So, there is lot difference in System.Diagnostic.Trace and Page.Trace.

Trace from Diagnostics display the trace information in output window of Visual studio whereas the Trace from page displays the Trace information in ASPX Page.

Integrate System.Diagnostics with ASPX Page (Routing all Trace information to web page)

We will need to add the listener in web.config file to route all the tracing information to the single web page.

To integrate the System.Diagnostics Trace with ASPX page, write below line of code in web.config.

       <add name="WebPageTraceListener"
            type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0, Culture=neutral,

The output will look like below image:
ASP.NET Tracing Application Level
trace.axd file

This file contains all the information about the tracing of the application.

To view the trace information just write the file name and you will get page which will look like below snap.

path structure : http://<servername>/webapp/trace.axd

Application Trace in ASP.NET
Application Trace in ASP.NET

Creating Custom Trace Listeners

Database trace listener

.NET has provided us the flexibility of writing our own Trace Listeners in the form of the TraceListener class. Every Trace Listener is inherited from this class; therefore, in order to implement your own Trace Listener, you must inherit your Trace Listener class from this class.

TraceListener class has many virtual and abstract methods; at the very least, each inheritor of this class must implement the Write and WriteLine methods; other important methods are Fail, Close, and Flush. Inheritors are not supposed to implement these methods but it is a good idea to implement these methods. Descriptions of these methods are given in the beginning of the article.

Method Name Result
Fail Outputs the specified text with the Call Stack.
Write Outputs the specified text.
WriteLine Outputs the specified text and a carriage return.
Flush Flushes the output buffer to the target media.
Close Closes the output stream in order to not receive the tracing/debugging output.

Write and WriteLine methods are overloaded; following is a list of all the overloaded version of the Write method:

  • public override void Write(string message)
  • public override void Write(object o)
  • public override void Write(string message, string category)
  • public override void Write(object o, string category)

For this article, I have created a Trace Listener, DatabaseTraceListener, which actually stores trace and debug messages into a database.

add below code in Web.config which stores the connection string information.

<pre><add key="ConnectionString" value="Data Source=.SQLExpress;Integrated Security=True;User Instance=True;
AttachDBFilename=|DataDirectory|TraceDB.mdf" /></pre>
<pre><add key="MaximumRequests" value="2" /></pre>

The structure of Table is:

  • TraceDateTime column stores the date and time of the trace message
  • TraceCategory column stores the actual category of the trace message
  • TraceDescription column stores the trace message
  • StackTrace column contains the stack trace
  • DetailedErrorDescription column contains the detailed error message which will be passed in second parameter of the Fail method.
  • create below stored procedure in SQLExpress

    Stored Procedure ASP.NET Tracing
    Now create a class named “DatabaseTraceListener” which inherit the abstract class “TraceListener”. You can check the code snippets in Source code of this article.

    if you want to implement your own Trace Listener, simply derive your listener class from TraceListener class, implement at least the Write and WriteLine methods and you are done.
    In our Example, Flush and Close methods simply save all the cached messages into the database.

    Saving Trace information in File

    We can also save the trace information in log files.

    To save the trace information in File, simply add the following entry in web.config

    <add name="myListener"
    initializeData="TextWriterOutput.log" />