Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Azure

Running a healthy service in the cloud : Configuring the diagnostic agent (part 1) - Default configuration

3/22/2011 4:46:21 PM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
If you’re writing your code in Visual Studio, the default Azure project templates include code that automatically starts the diagnostic agent, inserts a listener for the agent in the web.config file, and configures the agent with a default configuration.

You can see this code in the OnStart() method in the WebRole.cs file.


The agent starts with the default configuration, all in one line. The line also points to a connection string in the service configuration that provides access to the Azure storage account you want the data to be transferred to. If you’re running in the development fabric on your desktop computer, you can configure it with the well-known development storage connection string UseDevelopmentStorage=true. This string provides all the data necessary to connect with the local instance of development storage.

You also need to create a trace listener for the diagnostic agent. The trace listener allows you to write to the Azure trace log in your code. Create a trace listener by adding the following lines in your web.config. If you’re using a standard template, this code is probably already included.

<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>


After you’ve set up the trace listener, you can use the trace methods to send information to any trace listeners. When you use them, set a category for the log entry. The category will help you filter and find the right data later on. You should differentiate between critical data that you’ll always want and verbose logging data that you’ll want only when you’re debugging an issue. You can use any string for the trace category you want, but be careful and stick to a standard set of categories for your project. If the categories vary too much (for example, you have critical, crit, and important), it’ll be too hard to find the data you’re looking for. To standardize on log levels, you can use the enumerated type LogLevel in Microsoft.WindowsAzure.Diagnostics. To write to the trace log, use a line like one of the following:

using System.Diagnostics;

System.Diagnostics.Trace.WriteLine(string.Format("Page loaded on {0}", System.DateTime.Now, "Information");

System.Diagnostics.Trace.WriteLine("Failed to connect to database. ", "Critical");


Only people who have access to your trace information using the diagnostics API will be able to see the log output. That being said, we don’t recommend exposing sensitive or personal information in the log. Instead of listing a person’s social security number, refer to it in an indirect manner, perhaps by logging the primary key in the customer table. That way, if you need the social security number, you can look it up easily, but it won’t be left out in plain text for someone to see.

Another benefit of using trace is that the trace output appears in the dev fabric UI, like in figure 1.

Figure 1. When writing to the trace channel, the entries are stored by the Windows Azure diagnostic trace listener to the Azure log, which can then be gathered and stored in your storage account for analysis. The trace output is also displayed in the dev fabric UI during development.


At a simple level, this is all you need to start the agent and start collecting the most common data. The basic diagnostic setup is almost done for you out of the box because there’s so much default configuration that comes with it.

1. Default configuration

When the diagnostic agent is first started, it has a default configuration. The default configuration collects the Windows Azure trace, diagnostic infrastructure logs, and IIS 7.0 logs automatically. These are the most common sources you’re likely to care about in most situations.

When you’re configuring the agent, you’ll probably follow a common flow. You’ll grab the current running configuration (or a default configuration) from the agent, adjust it to your purposes, and then restart the agent. This configuration workflow is shown in figure 2.

Figure 2. Use the GAS process to configure and work with the diagnostic agent. Grab the config, adjust the config, and then start the agent. Sometimes you’ll grab the default config and sometimes the running config.


By default, the agent buffers about 4 GB of data locally, and ages out data automatically when the limit is reached. You can change these settings if you want, but most people leave them as is and just transfer the data to storage for long-term keeping.

Although the agent ages out data locally to the role instance, the retention of data after it’s moved to Azure storage is up to you. You can keep it there forever, dump it periodically, or download it to a local disk. After it’s been transferred to your account, the diagnostic agent doesn’t touch your data again. The data will just keep piling up if you let it.

In the next few sections, we’ll look at some of the common configuration scenarios, including how to filter the log for the data you’re interested in before it’s uploaded to storage.

Other -----------------
- Running a healthy service in the cloud : Diagnostics in the cloud
- SOA Security with .NET and Windows Azure : Windows Identity Foundation (part 3)
- SOA Security with .NET and Windows Azure : Windows Identity Foundation (part 2) - Windows Cardspace & Active Directory Federation Services
- SOA Security with .NET and Windows Azure : Windows Identity Foundation (part 1) - Digital Identity
- SQL Azure and relational data : Common SQL Azure scenarios
- SQL Azure and relational data : Limitations of SQL Azure
- SQL Azure and relational data : Migrating an application to SQL Azure
- SQL Azure and relational data : Managing your database
- Authentication and Authorization with WCF (part 3) - Claims-Based Authorization
- Authentication and Authorization with WCF (part 2) - Role-Based Authorization
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server