Apache Log4cxx  Version 1.5.0
Loading...
Searching...
No Matches
log4cxx::LogManager Class Reference

Use the LogManager class to retreive Logger instances or to operate on the current LoggerRepository. More...

#include <logmanager.h>

Static Public Member Functions

static void setRepositorySelector (spi::RepositorySelectorPtr selector, void *guard)
 Use selector to source the LoggerRepository, but only if the correct guard is passed as parameter.
static spi::LoggerRepositoryPtr getLoggerRepository ()
static LoggerPtr getRootLogger ()
 Retrieve the root logger from the LoggerRepository.
static LoggerPtr getLogger (const std::string &name)
 Retrieve the name Logger instance from the LoggerRepository using the default factory to create it if required.
static LoggerPtr getLogger (const std::string &name, const spi::LoggerFactoryPtr &factory)
 Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.
static LoggerPtr exists (const std::string &name)
 A pointer to the Logger name instance if it exists in the LoggerRepository.
static LoggerPtr getLogger (const std::wstring &name)
 Retrieve the name Logger instance from the LoggerRepository using the default factory to create it if required.
static LoggerPtr getLogger (const std::wstring &name, const spi::LoggerFactoryPtr &factory)
 Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.
static LoggerPtr exists (const std::wstring &name)
 A pointer to the Logger name instance if it exists in the LoggerRepository.
static LoggerPtr getLogger (const std::basic_string< UniChar > &name)
 Retrieve the name Logger instance from the LoggerRepository using the default factory to create it if required.
static LoggerPtr getLogger (const std::basic_string< UniChar > &name, const spi::LoggerFactoryPtr &factory)
 Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.
static LoggerPtr exists (const std::basic_string< UniChar > &name)
 A pointer to the Logger name instance if it exists in the LoggerRepository.
static LoggerPtr getLogger (const CFStringRef &name)
 Retrieve the name Logger instance from the LoggerRepository using the default factory to create it if required.
static LoggerPtr getLogger (const CFStringRef &name, const spi::LoggerFactoryPtr &factory)
 Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.
static LoggerPtr exists (const CFStringRef &name)
 A pointer to the Logger name instance if it exists in the LoggerRepository.
static LoggerPtr getLoggerLS (const LogString &name)
 Retrieve the name Logger instance from the LoggerRepository using the default factory to create it if required.
static LoggerPtr getLoggerLS (const LogString &name, const spi::LoggerFactoryPtr &factory)
 Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.
static LoggerPtr existsLS (const LogString &name)
 A pointer to the Logger name instance if it exists in the LoggerRepository.
static LoggerList getCurrentLoggers ()
static void shutdown ()
 Safely close and remove all appenders in all loggers including the root logger.
static void resetConfiguration ()
 Reset all values contained in this current LoggerRepository to their default.
static bool removeLogger (const LogString &name, bool ifNotUsed=true)
 Remove the name Logger from the LoggerRepository.

Detailed Description

Use the LogManager class to retreive Logger instances or to operate on the current LoggerRepository.

DefaultConfigurator::configure will be used to configure LoggerRepository when the first logger is retrieved if it is not already configured.

Member Function Documentation

◆ exists() [1/4]

LoggerPtr log4cxx::LogManager::exists ( const CFStringRef & name)
static

A pointer to the Logger name instance if it exists in the LoggerRepository.

Returns
A null pointer unless the name Logger already exists.

◆ exists() [2/4]

LoggerPtr log4cxx::LogManager::exists ( const std::basic_string< UniChar > & name)
static

A pointer to the Logger name instance if it exists in the LoggerRepository.

Returns
A null pointer unless the name Logger already exists.

◆ exists() [3/4]

LoggerPtr log4cxx::LogManager::exists ( const std::string & name)
static

A pointer to the Logger name instance if it exists in the LoggerRepository.

Returns
A null pointer unless the name Logger already exists.

◆ exists() [4/4]

LoggerPtr log4cxx::LogManager::exists ( const std::wstring & name)
static

A pointer to the Logger name instance if it exists in the LoggerRepository.

Returns
A null pointer unless the name Logger already exists.

◆ existsLS()

LoggerPtr log4cxx::LogManager::existsLS ( const LogString & name)
static

A pointer to the Logger name instance if it exists in the LoggerRepository.

Returns
A null pointer unless the name Logger already exists.

◆ getCurrentLoggers()

LoggerList log4cxx::LogManager::getCurrentLoggers ( )
static

◆ getLogger() [1/8]

LoggerPtr log4cxx::LogManager::getLogger ( const CFStringRef & name)
static

Retrieve the name Logger instance from the LoggerRepository using the default factory to create it if required.

Calls ensureIsConfigured passing DefaultConfigurator::configure to ensure the repository is configured.

◆ getLogger() [2/8]

LoggerPtr log4cxx::LogManager::getLogger ( const CFStringRef & name,
const spi::LoggerFactoryPtr & factory )
static

Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.

Calls ensureIsConfigured passing DefaultConfigurator::configure to ensure the repository is configured.

◆ getLogger() [3/8]

LoggerPtr log4cxx::LogManager::getLogger ( const std::basic_string< UniChar > & name)
static

Retrieve the name Logger instance from the LoggerRepository using the default factory to create it if required.

Calls ensureIsConfigured passing DefaultConfigurator::configure to ensure the repository is configured.

◆ getLogger() [4/8]

LoggerPtr log4cxx::LogManager::getLogger ( const std::basic_string< UniChar > & name,
const spi::LoggerFactoryPtr & factory )
static

Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.

Calls ensureIsConfigured passing DefaultConfigurator::configure to ensure the repository is configured.

◆ getLogger() [5/8]

LoggerPtr log4cxx::LogManager::getLogger ( const std::string & name)
static

Retrieve the name Logger instance from the LoggerRepository using the default factory to create it if required.

Calls ensureIsConfigured passing DefaultConfigurator::configure to ensure the repository is configured.

Examples
com/foo/config-qt.cpp, and com/foo/config1.cpp.

◆ getLogger() [6/8]

LoggerPtr log4cxx::LogManager::getLogger ( const std::string & name,
const spi::LoggerFactoryPtr & factory )
static

Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.

Calls ensureIsConfigured passing DefaultConfigurator::configure to ensure the repository is configured.

◆ getLogger() [7/8]

LoggerPtr log4cxx::LogManager::getLogger ( const std::wstring & name)
static

Retrieve the name Logger instance from the LoggerRepository using the default factory to create it if required.

Calls ensureIsConfigured passing DefaultConfigurator::configure to ensure the repository is configured.

◆ getLogger() [8/8]

LoggerPtr log4cxx::LogManager::getLogger ( const std::wstring & name,
const spi::LoggerFactoryPtr & factory )
static

Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.

Calls ensureIsConfigured passing DefaultConfigurator::configure to ensure the repository is configured.

◆ getLoggerLS() [1/2]

LoggerPtr log4cxx::LogManager::getLoggerLS ( const LogString & name)
static

Retrieve the name Logger instance from the LoggerRepository using the default factory to create it if required.

Calls ensureIsConfigured passing DefaultConfigurator::configure to ensure the repository is configured.

◆ getLoggerLS() [2/2]

LoggerPtr log4cxx::LogManager::getLoggerLS ( const LogString & name,
const spi::LoggerFactoryPtr & factory )
static

Retrieve the name Logger instance from the LoggerRepository using factory to create it if required.

Calls ensureIsConfigured passing DefaultConfigurator::configure to ensure the repository is configured.

◆ getLoggerRepository()

spi::LoggerRepositoryPtr log4cxx::LogManager::getLoggerRepository ( )
static

◆ getRootLogger()

LoggerPtr log4cxx::LogManager::getRootLogger ( )
static

Retrieve the root logger from the LoggerRepository.

Calls ensureIsConfigured passing DefaultConfigurator::configure to ensure the repository is configured.

Examples
com/foo/config-qt.cpp, and com/foo/config1.cpp.

◆ removeLogger()

bool log4cxx::LogManager::removeLogger ( const LogString & name,
bool ifNotUsed = true )
static

Remove the name Logger from the LoggerRepository.

Note: The name Logger must be retrieved from the LoggerRepository after any subsequent configuration file change for the newly loaded settings to be used.

Parameters
nameThe logger to remove.
ifNotUsedIf true and use_count() indicates there are other references, do not remove the Logger and return false.
Returns
true if name Logger was removed from the LoggerRepository.

◆ resetConfiguration()

void log4cxx::LogManager::resetConfiguration ( )
static

Reset all values contained in this current LoggerRepository to their default.

◆ setRepositorySelector()

void log4cxx::LogManager::setRepositorySelector ( spi::RepositorySelectorPtr selector,
void * guard )
static

Use selector to source the LoggerRepository, but only if the correct guard is passed as parameter.

Initally the guard is null. If the guard is null, then invoking this method sets the logger factory and the guard. Following invocations will throw a IllegalArgumentException, unless the previously set guard is passed as the second parameter.

This allows a high-level component to set the RepositorySelector used by the LogManager.

◆ shutdown()

void log4cxx::LogManager::shutdown ( )
static

Safely close and remove all appenders in all loggers including the root logger.

Examples
com/foo/config-qt.cpp, and com/foo/config1.cpp.

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