Unified Logging Featured on Channel 9

Recently Unified Logging was featured on Microsoft’s Channel 9.

Check out some of the inside details of how Unified Logging does its magic.

Comments Off

Deliver with Production Support Confidence

As many companies have learned when an application is put into production, support quickly becomes a higher priority.  When something does not work as expected is when things get interesting.

Do you know when something goes wrong?

How were you notified?  By a customer having an issue?

When software is being developed logging (using a variety of frameworks) is put in that should log errors, warning and information at a minimum.  This logging is the lifeline to proactive support when an application enters into production so make sure you get the long story and application support gets notified when they should be.

One of the many benefits of using Unified Logging is the separation between logging and notifications.  Let the application support engineers control when to be notified and leave the software engineers to instrumenting the code to log the long story.

For .NET applications Unified Logging ships a NuGet package which allows you to quickly add a trace listener to your application and start sending information. There are other connectors available and you can always build your own.

Stop waiting and signup.

Comments Off

Tracing, EntLib, Log4Net, NLog OH MY!

I received a question about if there was an appender for log4net which the answer is no.  The reason being is the trace listener can work with log4net as well as entlib and nlog.

What I did was create a very quick sample of using the trace listener for .NET Tracing, Enterprise Library, Log4Net and NLog.  This sample is not meant to show best practices (after all it is just a few buttons on a web form) but rather to show the configuration needed to use the Unified Logging trace listener in each of these logging frameworks.

Once you download the sample add your AccessKey and SecretKey from your Profile and update the initializeData for the trace listener in the web.config and in the entlib.config

initializeData=”AccessKey=, SecretKey=, SubmissionUrl=”

Comments Off

Unified Logging is Free for 2012!

For the rest of 2012 Unified Logging is offering unlimited messages to everyone!

If you are a .NET developer check out the NuGet Packages just released!

Comments Off

Unified Logging Releases NuGet Packages

Unified Logging® is proud to announce the availability of NuGet packges for .NET, Windows PhoneSilverlight and jQuery.

Get up and running fast with Unified Logging and these new packages:

Comments Off

Getting Started With Silverlight NuGet Package

If you have made it here chances are you have installed Unified Logging Silverlight NuGet package. If not, open up the NuGet package manager and search for “UnifiedLogging”.

Now that you have a reference to the client assembly you need to visit the Profile page and grab your Access Key and Secret Key.

To send data to Unified Logging you use the ULSubmitDataRequest like below.

var request = new ULSubmitDataRequest(accessKey, secretKey, submissionUrl, message);
request.SubmitAsync(OnCallback);

Then the callback method would be something like the below.

private void OnCallback(IAsyncResult result)
{
var submitResult = (SubmitResult) result;
if (submitResult.SubmitResultState.HttpStatus == HttpStatusCode.Created)
{
//Success!
}
else
{
//Failed!
}
}
 

Here is an example of a class called ULLog, which is contained in the code download sample, that will keep this functinality more contained, simple to use and leverage the failed request queue. To use the ULLog new it up when the application starts up with your Access Key, Secret Key and Submission Url.

/// <summary>
/// This is an example of how you can construct a logger for unified logging which uses the failover queue
/// </summary>
public class ULLog
{
private static string _accessKey;
private static string _secretKey;
private static string _submissionUrl;
private static ULLog instance;
private readonly FailedRequestQueue failedRequestQueue;
 
public ULLog(string accessKey, string secretKey, string submissionUrl)
{
_accessKey = accessKey;
_secretKey = secretKey;
_submissionUrl = submissionUrl;
failedRequestQueue = new FailedRequestQueue(ProcessFailedMessages);
 
instance = this;
}
 
public static ULLog Current
{
get
{
if (instance == null)
{
throw new Exception(“ULLog Not Initialized, please use constructor to initialize”);
}
 
return instance;
}
}
 
public FailedRequestQueue FailedRequestQueue
{
get { return failedRequestQueue; }
}
 
private static bool ProcessFailedMessages(string message)
{
try
{
var httpResult = HttpStatusCode.BadRequest;
using (var resetEvent = new ManualResetEvent(false))
{
var request = new ULSubmitDataRequest(_accessKey, _secretKey, _submissionUrl, message);
request.SubmitAsync(result =>
{
var submitResult = (SubmitResult) result;
httpResult = submitResult.SubmitResultState.HttpStatus;
resetEvent.Set();
});
 
resetEvent.WaitOne(TimeSpan.FromSeconds(30));
 
if (httpResult != HttpStatusCode.Created)
{
//failed to be submitted, stop processing and wait
return false;
}
else
{
//remove the message that was just sent
return true;
}
}
}
catch (Exception ex)
{
return false;
}
}
 
public void Write(string message, AsyncCallback callback)
{
var request = new ULSubmitDataRequest(_accessKey, _secretKey, _submissionUrl, message);
 
request.SubmitAsync(callback);
}
 
}

NEXT STEP: Learn About Indexes

Comments Off

Getting Started With Windows Phone NuGet Package

If you have made it here chances are you have installed Unified Logging Windows Phone NuGet package. If not, open up the NuGet package manager and search for “UnifiedLogging”.

Now that you have a reference to the client assembly you need to visit the Profile page and grab your Access Key and Secret Key.

To send data to Unified Logging you use the ULSubmitDataRequest like below.

 var request = new ULSubmitDataRequest(accessKey,  secretKey,  submissionUrl, message);
 request.SubmitAsync(OnCallback);

Then the callback method would be something like the below.

private void OnCallback(IAsyncResult result)
{
    var submitResult = (SubmitResult) result;
    if (submitResult.SubmitResultState.HttpStatus == HttpStatusCode.Created)
    {
        //Success!
    }
    else
    {
          //Failed!
    }
}
 

Here is an example of a class called ULLog, which is contained in the code download sample, that will keep this functinality more contained, simple to use and leverage the failed request queue.  To use the ULLog new it up when the application starts up with your Access Key, Secret Key and Submission Url.

/// <summary>
/// This is an example of how you can construct a logger for unified logging which uses the failover queue
/// </summary>
public class ULLog
{
    private static string _accessKey;
    private static string _secretKey;
    private static string _submissionUrl;
    private static ULLog instance;
    private readonly FailedRequestQueue failedRequestQueue;
 
    public ULLog(string accessKey, string secretKey, string submissionUrl)
    {
        _accessKey = accessKey;
        _secretKey = secretKey;
        _submissionUrl = submissionUrl;
        failedRequestQueue = new FailedRequestQueue(ProcessFailedMessages);
 
        instance = this;
    }
  
    public static ULLog Current
    {
         get
        {
              if (instance == null)
             {
                      throw new Exception(“ULLog Not Initialized, please use constructor to initialize”);
             }
 
             return instance;
        }
    }
 
    public FailedRequestQueue FailedRequestQueue
    {
        get { return failedRequestQueue; }
    }
 
    private static bool ProcessFailedMessages(string message)
    {
        try
        {
              var httpResult = HttpStatusCode.BadRequest;
              using (var resetEvent = new ManualResetEvent(false))
             {
                    var request = new ULSubmitDataRequest(_accessKey, _secretKey, _submissionUrl, message);
                    request.SubmitAsync(result =>
                                                           {
                                                               var submitResult = (SubmitResult) result;
                                                               httpResult = submitResult.SubmitResultState.HttpStatus;
                                                               resetEvent.Set();
                                                          });
 
                  resetEvent.WaitOne(TimeSpan.FromSeconds(30));
 
                  if (httpResult != HttpStatusCode.Created)
                 {
                         //failed to be submitted, stop processing and wait
                        return false;
                  }
                 else
                 {
                       //remove the message that was just sent
                      return true;
                  }
              }
         }
        catch (Exception ex)
       {
            return false;
        }
    }
  
    public void Write(string message, AsyncCallback callback)
    {
         var request = new ULSubmitDataRequest(_accessKey,  _secretKey, _submissionUrl, message);
 
         request.SubmitAsync(callback);
    }
 
}

NEXT STEP: Learn About Indexes

Comments Off

Getting Started With .NET NuGet Package

If you have made it here chances are you have installed Unified Logging NuGet package.  If not, open up the NuGet package manager and search for “UnifiedLogging”.

Now that you have a reference to the client assembly you are ready to use the trace listener that is contained within it.

It is no accident that this package does not mess with your configuration, this is because different logging frameworks can be used.  First you must visit the Profile page and grab your Access Key and Secret Key.

Here are examples for you to use:

.NET Tracing – Notice the use of the EventTypeFilter:
<system.diagnostics>
    <trace autoflush=”true” indentsize=”4″>
      <listeners>
        <clear/>
        <add name=”UnifiedLoggingListener”
             type=”UnifiedLogging.Client.ULListener, UnifiedLogging.Client”
             initializeData=”AccessKey=[AccessKey], SecretKey=[SecretKey], SubmissionUrl=https://data.unifiedlogging.com/ulmessages/” >
          <filter type=”System.Diagnostics.EventTypeFilter” initializeData=”Error”/>
        </add>
      </listeners>
    </trace>
  </system.diagnostics>

Enterprise Library – in the loggingConfiguration listeners section:
<add listenerDataType=”Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.SystemDiagnosticsTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″
 type=”UnifiedLogging.Client.ULListener, UnifiedLogging.Client”
 traceOutputOptions=”None” filter=”All” name=”ULListener” initializeData=”AccessKey=[AccessKey], SecretKey=[SecretKey], SubmissionUrl=https://data.unifiedlogging.com/ulmessages/” />

By adding one of the above to your configuration you will now be sending information to Unified Logging.

This assembly also contains supporting classes like the ULSubmitDataRequest which would allow one to submit data to Unified Logging and is used by the trace listener.
There is also a FailedRequestQueue which is used by the trace listener, when a request fails it will be retried every 30 seconds.  This queue is in memory and by default holds 100 messages.  The number of messages the FailedRequestQueue will hold can be set in the initialize data by setting the FailedQueueMax.

Example Showing .NET Tracing:
<system.diagnostics>
    <trace autoflush=”true” indentsize=”4″>
      <listeners>
        <clear/>
        <add name=”UnifiedLoggingListener”
             type=”UnifiedLogging.Client.ULListener, UnifiedLogging.Client”
             initializeData=”AccessKey=[AccessKey], SecretKey=[SecretKey], SubmissionUrl=https://data.unifiedlogging.com/ulmessages/, FailedQueueMax=5” >
          <filter type=”System.Diagnostics.EventTypeFilter” initializeData=”Error”/>
        </add>
      </listeners>
    </trace>
  </system.diagnostics>

NEXT STEP: Learn About Indexes

Comments Off

NEW Feature – Trends Filtering and Timeframe

We recently released new features for the Trends view.  Unified Logging gives the ability to create many indexes which in turn can make looking at the Trends view cluttered.  To resolve this Indexes can be chosen so you only look at the ones you want too.  In addition the timescale can be adjusted between 7, 14 and 30 days which can further bring clarity to the information you are looking for.

Comments Off

Indexes 101 – The Basics

Indexes in Unified Logging are the primary way pieces of data that are of interest are identified.  At its core indexes are regular expression.

Why regular expressions?  Regular expressions allow application support to define very simple to very complex pattern matching and even the novice application support engineer already knows regular expressions as that is how they currently navigate large log files.

Index Types

Custom: A custom index is really just the base regular expression, if you are a regular expression pro this is probably the only index type you will use.

Data: This index matches on values in key:value pairs {e.g. Machine:Web1}.  This index type is a helper on top of the custom index type to get up and running quickly if you do not want to mess with regular expression.

Notification: This index matches on a word or phrase and you wish to be notified when this occurs.  More on notification conditions soon.  This index type is a helper on top of the custom index type to get up and running quickly if you do not want to mess with regular expression.

Index Properties

Indexes have some common properties such as name, color and regular expression and priority order.

Name: Make the index name something easily identifiable at a glance.

Color: The color is used in multiple places.  If you choose a color it will be used to highlight matches in notifications, messages on the web and in trends.

Priority Order: The priority order defines the order in which notification indexes are processed, more in the next post.

There are additional properties for notifications that will be discussed in the next post.

NEXT -> Indexes 102 – Notifications

Leave a Comment