Home > Articles > Programming > C/C++

  • Print
  • + Share This
This chapter is from the book

0.5 Example: A Networked Logging Service

Throughout this book we use a running example of a networked logging service to help illustrate key points and ACE capabilities. This service collects and records diagnostic information sent from one or more client applications. It's a departure from the usual way of logging to a Windows NT/2000 event log, which is not available on Windows 95 or 98. If you're an experienced UNIX programmer, however, you may be thinking this is a waste of time since SYSLOGD provides this type of service already. Yet this underscores a key benefit of the logging service: it's portable, so applications can log messages on all platforms that ACE supports.

The logging service example is a microcosm of the actual Logging Service in ACE. ACE's logging service can be configured dynamically via the Component Configurator pattern [SSRB00] and ACE Service Configurator framework [SH]. By applying the Adapter pattern [GHJV95], records can be redirected to a UNIX SYSLOGD or to the Windows NT/2000 event log, or both—even if the initiating application is on another type of OS platform. This book's logging service example is purposely scaled back so we can focus on mastering complexity. Figure 0.6 illustrates the application processes and server in our networked logging service. Below, we outline the key entities shown in Figure 0.6.

Client application processes run on client hosts and generate log records ranging from debugging messages to critical error messages. The logging information sent by a client application indicates the following:

  1. The time the log record was created

  2. The process identifier of the application

  3. The priority level of the log record and

  4. A string containing the logging message text, which can vary in size from 0 to a configurable maximum length, such as 4K bytes.

Figure 0.6: Participants in the Networked Logging Service

Logging servers collect and output log records received from client applications. A logging server can determine which client host sent each message by using addressing information it obtains from the Socket API. There's generally one logging server per system configuration, though they can be replicated to enhance fault tolerance.

Throughout the book, we refer to the networked logging service to make our discussion of domain analysis dimensions for networked applications more concrete. The architecture of our logging service is driven by this domain analysis. Just as real products change in scope as they progress through their life cycles, the logging service's design, functionality, scalability, and robustness will evolve as we progress through this book and [SH]. We'll continue developing this service incrementally to show solutions to common design challenges using many key patterns implemented by classes in ACE. Sidebar 2 describes how to build the ACE library so that you can experiment with the examples we present in this book.

Sidebar 2: Building ACE and Programs that Use ACE

ACE is open-source software, so you can download it from http://ace.ece.uci.edu and build it yourself. Here are some tips to help you understand the source examples we show, and how to build ACE, the examples, and your own applications:

  • Install ACE in an empty directory. The top-level directory in the distribution is named ACE_wrappers. We refer to this top-level directory as $ACE_ROOT. Create an environment variable by that name containing the full path to the top-level ACE directory.

  • The ACE source and header files reside in $ACE_ROOT/ace.

  • The source and header files for this book's networked logging service examples reside in $ACE_ROOT/examples/C++NPv1.

  • When compiling your programs, the $ACE_ROOT directory must be added to your compiler's file include path, which is often designated by the -I or /I compiler option.

  • The $ACE_ROOT/ACE-INSTALL.html file contains complete instructions on building and installing ACE and programs that use ACE.

You can also purchase a prebuilt version of ACE from Riverace at a nominal cost. A list of the prebuilt compiler and OS platforms supported by Riverace is available at http://www.riverace.com.

  • + Share This
  • 🔖 Save To Your Account