log4shib 2.0.0

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
log4shib::NTEventLogAppender Class Reference

NTEventLogAppender is an Appender that sends LoggingEvents to the Windows event log. More...

`#include <NTEventLogAppender.hh>`

Inheritance diagram for log4shib::NTEventLogAppender:
[legend]
Collaboration diagram for log4shib::NTEventLogAppender:
[legend]

## Public Member Functions
| NTEventLogAppender (const std::string &name, const std::string &sourceName)
| Instantiate an NTEventLogAppender with given name and source. More...
virtual | ~NTEventLogAppender ()
virtual bool | reopen ()
| Calls open() and close() More...
virtual void | close ()
| Release any resources allocated within the appender such as file handles, network connections, etc. More...
Public Member Functions inherited from log4shib::LayoutAppender
| LayoutAppender (const std::string &name)
virtual | ~LayoutAppender ()
virtual bool | requiresLayout () const
| Check if the appender requires a layout. More...
virtual void | setLayout (Layout *layout=NULL)
| Set the Layout for this appender. More...
Public Member Functions inherited from log4shib::AppenderSkeleton
virtual | ~AppenderSkeleton ()
| Destructor for AppenderSkeleton. More...
virtual void | doAppend (const LoggingEvent &event)
| Log in Appender specific way. More...
virtual bool | reopen ()
| Reopens the output destination of this Appender, e.g. More...
virtual void | close ()=0
| Release any resources allocated within the appender such as file handles, network connections, etc. More...
virtual bool | requiresLayout () const =0
| Check if the appender uses a layout. More...
virtual void | setLayout (Layout *layout)=0
| Set the Layout for this appender. More...
virtual void | setThreshold (Priority::Value priority)
| Set the threshold priority of this Appender. More...
virtual Priority::Value | getThreshold ()
| Get the threshold priority of this Appender. More...
virtual void | setFilter (Filter *filter)
| Set a Filter for this appender. More...
virtual Filter * | getFilter ()
| Get the Filter for this appender. More...
Public Member Functions inherited from log4shib::Appender
virtual | ~Appender ()
| Destructor for Appender. More...
virtual void | doAppend (const LoggingEvent &event)=0
| Log in Appender specific way. More...
virtual bool | reopen ()=0
| Reopens the output destination of this Appender, e.g. More...
virtual void | close ()=0
| Release any resources allocated within the appender such as file handles, network connections, etc. More...
virtual bool | requiresLayout () const =0
| Check if the appender uses a layout. More...
virtual void | setLayout (Layout *layout)=0
| Set the Layout for this appender. More...
const std::string & | getName () const
| Get the name of this appender. More...
virtual void | setThreshold (Priority::Value priority)=0
| Set the threshold priority of this Appender. More...
virtual Priority::Value | getThreshold ()=0
| Get the threshold priority of this Appender. More...
virtual void | setFilter (Filter *filter)=0
| Set a Filter for this appender. More...
virtual Filter * | getFilter ()=0
| Get the Filter for this appender. More...

## Protected Member Functions
WORD | getCategory (Priority::Value priority)
| Convert log4shib Priority to an EventLog category. More...
WORD | getType (Priority::Value priority)
| Convert log4shib Priority to an EventLog type. More...
HKEY | regGetKey (TCHAR *subkey, DWORD *disposition)
void | regSetString (HKEY hkey, const TCHAR *name, const TCHAR *value)
void | regSetDword (HKEY hkey, const TCHAR *name, DWORD value)
void | addRegistryInfo (const char *source)
virtual void | open ()
virtual void | _append (const LoggingEvent &event)
| Sends a LoggingEvent to NT Event log. More...
Protected Member Functions inherited from log4shib::LayoutAppender
Layout & | _getLayout ()
| Return the layout of the appender. More...
Protected Member Functions inherited from log4shib::AppenderSkeleton
| AppenderSkeleton (const std::string &name)
| Constructor for AppenderSkeleton. More...
virtual void | _append (const LoggingEvent &event)=0
| Log in Appender specific way. More...
Protected Member Functions inherited from log4shib::Appender
| Appender (const std::string &name)
| Constructor for Appender. More...

## Protected Attributes
HANDLE | _hEventSource
std::string | _strSourceName

## Additional Inherited Members
Public Types inherited from log4shib::LayoutAppender
typedef BasicLayout | DefaultLayoutType
Static Public Member Functions inherited from log4shib::Appender
static Appender * | getAppender (const std::string &name)
| Get a pointer to an exitsing Appender. More...
static bool | reopenAll ()
| Call reopen() on all existing Appenders. More...
static void | closeAll ()
| Call reopen() on all existing Appenders. More...

## Detailed Description

NTEventLogAppender is an Appender that sends LoggingEvents to the Windows event log.

Building log4shib.dsp/log4shibDLL.dsp creates the resource DLL NTEventLogAppender.dll. Do not forget to place this DLL in a directory that is on the PATH of the Windows system. Otherwise, the category and message will not display correctly in Event Viewer.
NB: This class is only available on Win32 platforms.

## Constructor & Destructor Documentation

## ◆ NTEventLogAppender()

log4shib::NTEventLogAppender::NTEventLogAppender | ( | const std::string & | name,
|  | const std::string & | sourceName
| ) |  |

Instantiate an NTEventLogAppender with given name and source.

Parameters

  name | The name of the Appender
  sourceName | The source name to log

## ◆ ~NTEventLogAppender()

log4shib::NTEventLogAppender::~NTEventLogAppender | ( |  | ) |
| virtual

## Member Function Documentation

## ◆ _append()

void log4shib::NTEventLogAppender::_append | ( | const LoggingEvent & | event | ) |
| protected virtual

Sends a LoggingEvent to NT Event log.

Parameters

  event | the LoggingEvent to log.

Implements log4shib::AppenderSkeleton.

## ◆ addRegistryInfo()

void log4shib::NTEventLogAppender::addRegistryInfo | ( | const char * | source | ) |
| protected

## ◆ close()

void log4shib::NTEventLogAppender::close | ( |  | ) |
| virtual

Release any resources allocated within the appender such as file handles, network connections, etc.

Implements log4shib::AppenderSkeleton.

## ◆ getCategory()

WORD log4shib::NTEventLogAppender::getCategory | ( | Priority::Value | priority | ) |
| protected

Convert log4shib Priority to an EventLog category.

Each category is backed by a message resource so that proper category names will be displayed in the NT Event Viewer.

## ◆ getType()

WORD log4shib::NTEventLogAppender::getType | ( | Priority::Value | priority | ) |
| protected

Convert log4shib Priority to an EventLog type.

The log4shib package supports 8 defined priorites, but the NT EventLog only knows 3 event types of interest to us: ERROR, WARNING, and INFO.

## ◆ open()

void log4shib::NTEventLogAppender::open | ( |  | ) |
| protected virtual

## ◆ regGetKey()

HKEY log4shib::NTEventLogAppender::regGetKey | ( | TCHAR * | subkey,
|  | DWORD * | disposition
| ) |  |
| protected

## ◆ regSetDword()

void log4shib::NTEventLogAppender::regSetDword | ( | HKEY | hkey,
|  | const TCHAR * | name,
|  | DWORD | value
| ) |  |
| protected

## ◆ regSetString()

void log4shib::NTEventLogAppender::regSetString | ( | HKEY | hkey,
|  | const TCHAR * | name,
|  | const TCHAR * | value
| ) |  |
| protected

## ◆ reopen()

bool log4shib::NTEventLogAppender::reopen | ( |  | ) |
| virtual

Calls open() and close()

Reimplemented from log4shib::AppenderSkeleton.

## Member Data Documentation

## ◆ _hEventSource

HANDLE log4shib::NTEventLogAppender::_hEventSource
| protected

## ◆ _strSourceName

std::string log4shib::NTEventLogAppender::_strSourceName
| protected

The documentation for this class was generated from the following files:

- NTEventLogAppender.hh
- NTEventLogAppender.cpp