Compartilhar via


Logging events to Azure table storage

patterns & practices Developer Center

This scenario is one of several that describe the typical requirements for using the Semantic Logging Application Block in your applications. It describes the process for setting up the block to send log events to Microsoft Azure table storage.

Typical Goals

You need to send logging information created as log entries to one or more sinks or targets, and the list of targets includes an Azure table. You want to set up the Semantic Logging Application Block to use a suitable event sink, configure the options and the log entry format, and configure Azure table storage to receive log entries.

Notes

If you are testing your application locally, you can use the Azure Storage Emulator that is included in the Microsoft Azure SDK. If you want to use a cloud-hosted storage account you must have previously set up a Microsoft Azure storage account and have access to the storage account key. To sign up for a new Azure storage account see the Azure Home page. You can open a free trial account from there.

Solution

The following steps describe the process, and provide links to more details for each step.

To configure logging to Azure table storage

  1. Define an event source for your application. For more information, see the topic Developing event sources using the .NET EventSource class.
  2. Write code to raise the events you defined in response to actions within the application. For more information, see the topic Raising events from your applications.
  3. Decide if you will use the in-process or out-of-process approach for collecting events. For more information to help you decide, see the topic Overview of logging using the Semantic Logging Application Block.
  4. If you choose to use the in-process approach:
    • Use NuGet to add the Semantic Logging Application Block and the Semantic Logging Application Block –Azure Sink packages to your Visual Studio project. For more information, see the topic Using the block in applications for the in-process scenario.
    • Add code to configure the Azure Table Storage event sink. You must specify the details of the Azure storage account you want to use, and you can configure several properties of the sink that control buffering. For more information, see the topics Choosing and using event sinks and the section “Configuring buffering” in the topic Performance considerations.
  5. If you choose to use the out-of-process approach:

Next Topic | Previous Topic | Home | Community