

Public Member Functions | |
| AcsLogger (String name, String resourceBundleName, LogConfig logConfig) | |
| String | getProcessName () |
| String | getSourceObject () |
| void | logToAudience (Level level, String msg, String audience) |
| void | logToAudience (Level level, String msg, Throwable thr, String audience) |
| AcsLogRecord | createAcsLogRecord (Level level, String msg) |
| void | log (LogRecord record) |
| void | configureLogging (LogConfig newLogConfig) |
| void | addLoggerClass (Class<?> loggerClass) |
| void | addIgnoreLogs (String className, String methodName) |
Static Public Member Functions | |
| static AcsLogger | createUnconfiguredLogger (String name, String resourceBundleName) |
| static AcsLogger | fromJdkLogger (Logger logger, String wrapLoggerName) |
Protected Member Functions | |
| AcsLogger (String name, String resourceBundleName, LogConfig logConfig, boolean allowNullLogConfig, Logger delegate) | |
Protected Attributes | |
| final Logger | delegate |
Static Protected Attributes | |
| static final int | offValue = Level.OFF.intValue() |
Package Functions | |
| void | setLoggerName (String newLoggerName) |
| String | getLoggerName () |
| void | setProcessName (String processName) |
| void | setSourceObject (String sourceObject) |
| void | configureLevels (UnnamedLogger loggerConfig) |
Private Member Functions | |
| final String | concatenateIgnoreLogData (String className, String methodName) |
Private Attributes | |
| final Set< String > | loggerClassNames = new HashSet<String>() |
| final Set< String > | callStacksToBeIgnored = new HashSet<String>() |
| LogConfig | logConfig |
| String | loggerName |
| String | processName |
| String | sourceObject |
| boolean | noLevelWarningPrinted = false |
| final boolean | DEBUG = Boolean.getBoolean("alma.acs.logging.verbose") |
A Logger that attaches additional information to the produced LogRecords.
This class should be used only by ACS or by similar framework layers in the Operator GUI etc. Normal application code should get the Logger object from the ContainerServices.
Design note: the additional data (thread name, line of code) are really most interesting for the remotely sent log messages. Thus an alternative implementation could put the code from log(LogRecord) into class alma.acs.logging.AcsLoggingHandler, and not use a custom Logger class at all. The main reason we do it anyway is to avoid throwing the dummy exception (that delivers the stack trace) twice.
| alma::acs::logging::AcsLogger::AcsLogger | ( | String | name, | |
| String | resourceBundleName, | |||
| LogConfig | logConfig | |||
| ) | [inline] |
Standard constructor that configures this logger from logConfig and also registers for log config changes.
| name | the logger's name | |
| resourceBundleName | may be null | |
| logConfig | the ACS logging configuration object, which gives optional access to the CDB. |
Referenced by createUnconfiguredLogger(), and fromJdkLogger().
| alma::acs::logging::AcsLogger::AcsLogger | ( | String | name, | |
| String | resourceBundleName, | |||
| LogConfig | logConfig, | |||
| boolean | allowNullLogConfig, | |||
| Logger | delegate | |||
| ) | [inline, protected] |
Auxiliary ctor. Don't use it directly from outside of this class.
| logConfig | may be null if allowNullLogConfig==true |
References addLoggerClass(), alma::acs::logging::config::LogConfig::addSubscriber(), configureLogging(), and DEBUG.
| void alma::acs::logging::AcsLogger::addIgnoreLogs | ( | String | className, | |
| String | methodName | |||
| ) | [inline] |
The AcsLogger can be configured to ignore certain logs. Note that this feature should not be used as a substitute for properly adjusting log levels and using repeat guards etc throughout the code. A valid use case would be to avoid "positive feedback" when the sending of a log produces one or more log messages, some of which may only be produced under special conditions, e.g. those coming from jacorb.
| className | class name where the log comes from. Must not be null. | |
| methodName | method name where the log comes from. Must not be null. |
References callStacksToBeIgnored, and concatenateIgnoreLogData().
Referenced by alma::acs::logging::ClientLogManager::getLoggerForCorba().
| void alma::acs::logging::AcsLogger::addLoggerClass | ( | Class<?> | loggerClass | ) | [inline] |
Adds a logger class, which will be used to skip entries in the stack trace until the original logging method is found. If you have a delegation chain that involves loggers besides AcsLogger and the normal JDK Logger, make sure you call this method for each of them.
| loggerClass |
References loggerClassNames.
Referenced by AcsLogger(), alma::acs::logging::domainspecific::AntennaContextLogger::AntennaContextLogger(), alma::acs::logging::domainspecific::ArrayContextLogger::ArrayContextLogger(), alma::acs::logging::adapters::JacORBLoggerFactory::getNamedLogger(), alma::acs::logging::LocalOnlyAcsLogger::LocalOnlyAcsLogger(), and alma::acs::logging::RepeatGuardLogger::RepeatGuardLogger().
| final String alma::acs::logging::AcsLogger::concatenateIgnoreLogData | ( | String | className, | |
| String | methodName | |||
| ) | [inline, private] |
Ensures that the same format of concatenated String is used in addIgnoreLogs(String, String) and log(LogRecord). Being private final, the compiler will hopefully inline calls to this method.
| fileName | ||
| methodName |
Referenced by addIgnoreLogs(), and log().
| void alma::acs::logging::AcsLogger::configureLevels | ( | UnnamedLogger | loggerConfig | ) | [inline, package] |
Extracted from configureLogging(LogConfig) to support also configuration of Loggers created with createUnconfiguredLogger(String, String) which do not know about a shared LogConfig.
| loggerConfig |
References log().
Referenced by configureLogging(), and alma::acs::logging::ClientLogManager::getLoggerForApplication().
| void alma::acs::logging::AcsLogger::configureLogging | ( | LogConfig | newLogConfig | ) | [inline] |
Callback method, configures this logger from the data in logConfig.
Implements alma::acs::logging::config::LogConfigSubscriber.
References configureLevels(), DEBUG, getLoggerName(), alma::acs::logging::config::LogConfig::getNamedLoggerConfig(), log(), and logConfig.
Referenced by AcsLogger(), setLoggerName(), and alma::acs::jlog::test::EngineFilteringTest::setUp().
| AcsLogRecord alma::acs::logging::AcsLogger::createAcsLogRecord | ( | Level | level, | |
| String | msg | |||
| ) | [inline] |
| static AcsLogger alma::acs::logging::AcsLogger::createUnconfiguredLogger | ( | String | name, | |
| String | resourceBundleName | |||
| ) | [inline, static] |
Non-standard factory method to be used only for special offline or testing purposes where typically an AcsLogger must be provided by an alternative implementation of ContainerServices. The returned AcsLogger is just like a JDK Logger obtained from Logger#getLogger(String, String).
Note that we do not supply a LogConfig and therefore the new AcsLogger cannot register itself for initial configuration or later configuration change notifications.
It is the client's responsibility to configure the log level and parent logger of the returned AcsLogger!
| name | the logger's name | |
| resourceBundleName |
AcsLogger that is as close to a normal JDK Logger as possible. | IllegalArgumentException | If a Logger of the given name exists but is not an AcsLogger, or if an AcsLogger of the given name exists but has a different resourceBundleName. |
References AcsLogger().
Referenced by alma::acs::logging::ClientLogManager::getLoggerForApplication(), and alma::ACS::MasterComponentImpl::statemachine::StateMachineTest::setUp().
| static AcsLogger alma::acs::logging::AcsLogger::fromJdkLogger | ( | Logger | logger, | |
| String | wrapLoggerName | |||
| ) | [inline, static] |
Client applications that use ACS class ComponentClient may need to turn their own JDK Logger into an AcsLogger.
If logger is itself of sub-type AcsLogger then it is returned directly without being wrapped. The wrapping logger shares the parent logger and the log level with the provided logger.
| logger | the JDK logger | |
| wrapperName | Name of the returned AcsLogger. May be null in which case the delegate's name plus "wrapper" is taken. |
logger. References AcsLogger().
Referenced by alma::acs::component::client::ComponentClient::ComponentClient(), and alma::acs::logging::AcsLoggerTest::testWrapJdkLogger().
| String alma::acs::logging::AcsLogger::getLoggerName | ( | ) | [inline, package] |
References loggerName.
Referenced by alma::acs::logging::ClientLogManager::addLocalHandler(), alma::acs::logging::ClientLogManager::addRemoteHandler(), configureLogging(), log(), alma::acs::logging::ClientLogManager::prepareRemoteLogging(), setLoggerName(), and alma::acs::logging::ClientLogManagerTest::testLoggerNameUniqueness().
| String alma::acs::logging::AcsLogger::getProcessName | ( | ) | [inline] |
References processName.
| String alma::acs::logging::AcsLogger::getSourceObject | ( | ) | [inline] |
References sourceObject.
| void alma::acs::logging::AcsLogger::log | ( | LogRecord | record | ) | [inline] |
Logs the given LogRecord. The record can be modified or dropped by the optional filters provided in addLogRecordFilter(alma.acs.logging.AcsLogger.LogRecordFilter).
Adding of context information:
AcsJException), or Note that by overloading this method, we intercept all logging activities of the base class.
References callStacksToBeIgnored, concatenateIgnoreLogData(), delegate, alma::acs::logging::LogParameterUtil::extractSpecialPropertiesMap(), getLoggerName(), alma::acs::logging::LogParameterUtil::getNonSpecialPropertiesMapParameters(), loggerClassNames, loggerName, noLevelWarningPrinted, and offValue.
Referenced by alma::acs::container::corba::AcsCorbaTestWithContainer::_testComponentPOALifecycle(), alma::acs::container::AcsContainer::activate_component(), alma::acs::container::ContainerServicesImpl::activateOffShoot(), configureLevels(), configureLogging(), alma::acs::container::ComponentAdapter::deactivateComponent(), alma::acs::alarmsystem::corbaservice::AlarmSystemCorbaServer::deactivateOffShoot(), alma::acs::genfw::runtime::sm::AcsDoActivity::execute(), alma::acs::container::ContainerServicesImpl::findComponents(), alma::acs::container::ContainerServicesImpl::fireComponentsAvailable(), alma::acs::container::ContainerServicesImpl::fireComponentsUnavailable(), alma::acs::alarmsystem::corbaservice::AlarmSystemCorbaServer::getAlarmSystemType(), alma::acs::container::ContainerServicesImpl::getCDB(), alma::alarmsystem::corbaservice::AlarmSystemContainerServices::getCDB(), alma::acs::container::AcsContainer::getCDB(), alma::acs::container::ContainerServicesImpl::getCollocatedComponent(), alma::acs::container::ContainerServicesImpl::getComponent(), alma::acs::container::ComponentAdapter::getComponentAbortionist(), alma::acs::container::ContainerServicesImpl::getComponentDescriptor(), alma::acs::container::ContainerServicesImpl::getComponentNonSticky(), alma::acs::container::ContainerServicesImpl::getDefaultComponent(), alma::acs::container::ContainerServicesImpl::getDynamicComponent(), alma::acs::container::AcsContainer::getExistingComponent(), alma::jconttest::util::JconttestUtil::getSystemLevelOrbTimeoutMillis(), alma::acs::container::AcsContainer::initialize(), alma::acs::component::client::ComponentClient::initRemoteLogging(), alma::acs::alarmsystem::corbaservice::AlarmSystemCorbaServer::instantiateCernAS(), alma::acs::alarmsystem::corbaservice::AlarmSystemCorbaServer::internalInitialize(), alma::acs::logging::RepeatGuardLogger::log(), alma::acs::logging::domainspecific::ArrayContextLogger::log(), alma::acs::logging::domainspecific::AntennaContextLogger::log(), alma::acs::genfw::runtime::sm::AcsDoActivity::logActionFailure(), logToAudience(), alma::acs::alarmsystem::corbaservice::AlarmServiceUtils::main(), alma::acs::alarmsystem::corbaservice::AlarmSystemCorbaServer::registerToNamingService(), alma::acs::container::ContainerServicesImpl::releaseComponent(), alma::acs::alarmsystem::corbaservice::AlarmSystemCorbaServer::run(), alma::acs::component::client::ComponentClientTestCase::runTest(), alma::acs::component::client::ComponentClientTestCase::setUp(), alma::acs::alarmsystem::corbaservice::AlarmSystemCorbaServer::shutdown(), alma::acs::logging::AcsLoggerTest::testAbuseLevelOff(), alma::acs::jlog::test::EngineFilteringTest::testFiltering(), alma::acs::component::client::ClientWithLogReceiverTest::testLogCapture(), alma::acs::component::client::ClientWithLogReceiverTest::testLogQueueNoDelay(), alma::acs::container::corba::AcsCorbaTestWithContainer::testParallelCalls(), and alma::acs::alarmsystem::corbaservice::AlarmSystemCorbaServer::unregisterToNamingService().
| void alma::acs::logging::AcsLogger::logToAudience | ( | Level | level, | |
| String | msg, | |||
| Throwable | thr, | |||
| String | audience | |||
| ) | [inline] |
References createAcsLogRecord(), log(), and alma::acs::logging::AcsLogRecord::setAudience().
| void alma::acs::logging::AcsLogger::logToAudience | ( | Level | level, | |
| String | msg, | |||
| String | audience | |||
| ) | [inline] |
References createAcsLogRecord(), log(), and alma::acs::logging::AcsLogRecord::setAudience().
Referenced by alma::acs::logging::AudienceLogger::config(), alma::acs::logging::AudienceLogger::fine(), alma::acs::logging::AudienceLogger::finer(), alma::acs::logging::AudienceLogger::finest(), alma::acs::logging::AudienceLogger::info(), alma::acs::logging::AudienceLogger::severe(), alma::acs::logging::AcsLoggerTest::testAudienceLog(), and alma::acs::logging::AudienceLogger::warning().
| void alma::acs::logging::AcsLogger::setLoggerName | ( | String | newLoggerName | ) | [inline, package] |
Optionally sets a logger name that can be different from the Logger#name passed in the constructor. The new name will be used for the LogRecords produced by this class. This allows changing the name later on, e.g. when a container name or JUnit test name should be appended to the simple name of a Corba logger.
| loggerName |
References configureLogging(), DEBUG, getLoggerName(), logConfig, loggerName, and alma::acs::logging::config::LogConfig::renameNamedLoggerConfig().
Referenced by alma::acs::logging::ClientLogManager::prepareRemoteLogging(), and alma::acs::logging::ClientLogManager::setProcessName().
| void alma::acs::logging::AcsLogger::setProcessName | ( | String | processName | ) | [inline, package] |
| void alma::acs::logging::AcsLogger::setSourceObject | ( | String | sourceObject | ) | [inline, package] |
Referenced by alma::acs::logging::ClientLogManager::getAcsLogger().
final Set<String> alma::acs::logging::AcsLogger::callStacksToBeIgnored = new HashSet<String>() [private] |
Concatenation of class and method names, with a "#" in between. Used for fast comparison of log stack frames, see addIgnoreLogs(String, String).
Referenced by addIgnoreLogs(), and log().
final boolean alma::acs::logging::AcsLogger::DEBUG = Boolean.getBoolean("alma.acs.logging.verbose") [private] |
Referenced by AcsLogger(), configureLogging(), and setLoggerName().
final Logger alma::acs::logging::AcsLogger::delegate [protected] |
Usually this is null, but factory method wrapJdkLogger(Logger) could supply this delegate.
Referenced by log().
Configuration data. May be null for instances created from non-standard factory methods.
Referenced by configureLogging(), and setLoggerName().
final Set<String> alma::acs::logging::AcsLogger::loggerClassNames = new HashSet<String>() [private] |
the logger class, which must be known to unwind the stack trace. Will be this class unless we use delegation. We don't share this set among Logger instances to avoid threading overheads for fast access.
Referenced by addLoggerClass(), and log().
String alma::acs::logging::AcsLogger::loggerName [private] |
Referenced by getLoggerName(), log(), and setLoggerName().
boolean alma::acs::logging::AcsLogger::noLevelWarningPrinted = false [private] |
Referenced by log().
final int alma::acs::logging::AcsLogger::offValue = Level.OFF.intValue() [static, protected] |
Referenced by log().
String alma::acs::logging::AcsLogger::processName [private] |
Referenced by getProcessName().
String alma::acs::logging::AcsLogger::sourceObject [private] |
TODO: check why we set the SourceObject as a field here, and also take the loggerName in the formatters to fill in the source object field there.
Referenced by getSourceObject().
1.6.2