Partager via


Logging events to the Console

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 using the block to send log events to the console.

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 a console window. You want to set up the Semantic Logging Application Block to use a suitable event sink and format the log entries.

Notes

The console event sink is not recommended for use in high-throughput or production scenarios. Typically, you will use it only during development and testing of your event logging strategy.

Solution

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

To configure logging to the console

  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:
  5. If you choose to use the out-of-process approach:

Next Topic | Previous Topic | Home | Community