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) |
A Logger
that attaches additional information to the produced LogRecord
s.
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 | |||
) |
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 alma.acs.logging.AcsLogger.createUnconfiguredLogger(), and alma.acs.logging.AcsLogger.fromJdkLogger().
alma.acs.logging.AcsLogger.AcsLogger | ( | String | name, | |
String | resourceBundleName, | |||
LogConfig | logConfig, | |||
boolean | allowNullLogConfig, | |||
Logger | delegate | |||
) | [protected] |
Auxiliary ctor. Don't use it directly from outside of this class.
logConfig | may be null if allowNullLogConfig==true |
References alma.acs.logging.AcsLogger.addLoggerClass(), alma.acs.logging.config.LogConfig.addSubscriber(), and alma.acs.logging.AcsLogger.configureLogging().
void alma.acs.logging.AcsLogger.addIgnoreLogs | ( | String | className, | |
String | methodName | |||
) |
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. |
Referenced by alma.acs.logging.ClientLogManager.getLoggerForCorba().
void alma.acs.logging.AcsLogger.addLoggerClass | ( | Class<?> | loggerClass | ) |
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 |
Referenced by alma.acs.logging.AcsLogger.AcsLogger(), alma.acs.logging.domainspecific.AntennaContextLogger.AntennaContextLogger(), alma.acs.logging.domainspecific.ArrayContextLogger.ArrayContextLogger(), alma.acs.logging.domainspecific.AudienceLogger.AudienceLogger(), org.slf4j.impl.ACSLoggerFactory.getLogger(), alma.acs.logging.adapters.JacORBLoggerFactory.getNamedLogger(), alma.acs.logging.domainspecific.AudienceLogger.log(), and alma.acs.logging.RepeatGuardLogger.RepeatGuardLogger().
void alma.acs.logging.AcsLogger.configureLevels | ( | UnnamedLogger | loggerConfig | ) | [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 alma.acs.logging.AcsLogger.log().
Referenced by alma.acs.logging.AcsLogger.configureLogging(), and alma.acs.logging.ClientLogManager.getLoggerForApplication().
void alma.acs.logging.AcsLogger.configureLogging | ( | LogConfig | newLogConfig | ) |
Callback method, configures this logger from the data in logConfig.
Implements alma.acs.logging.config.LogConfigSubscriber.
References alma.acs.logging.AcsLogger.configureLevels(), alma.acs.logging.AcsLogger.getLoggerName(), alma.acs.logging.config.LogConfig.getNamedLoggerConfig(), and alma.acs.logging.AcsLogger.log().
Referenced by alma.acs.logging.AcsLogger.AcsLogger(), and alma.acs.logging.AcsLogger.setLoggerName().
AcsLogRecord alma.acs.logging.AcsLogger.createAcsLogRecord | ( | Level | level, | |
String | msg | |||
) |
static AcsLogger alma.acs.logging.AcsLogger.createUnconfiguredLogger | ( | String | name, | |
String | resourceBundleName | |||
) | [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 alma.acs.logging.AcsLogger.AcsLogger().
Referenced by alma.acs.logging.ClientLogManager.getLoggerForApplication().
static AcsLogger alma.acs.logging.AcsLogger.fromJdkLogger | ( | Logger | logger, | |
String | wrapLoggerName | |||
) | [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 alma.acs.logging.AcsLogger.AcsLogger().
Referenced by alma.acs.component.client.ComponentClient.ComponentClient().
String alma.acs.logging.AcsLogger.getLoggerName | ( | ) | [package] |
String alma.acs.logging.AcsLogger.getProcessName | ( | ) |
String alma.acs.logging.AcsLogger.getSourceObject | ( | ) |
void alma.acs.logging.AcsLogger.log | ( | LogRecord | record | ) |
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 alma.acs.logging.AcsLogger.delegate, alma.acs.logging.LogParameterUtil.extractSpecialPropertiesMap(), alma.acs.logging.AcsLogger.getLoggerName(), alma.acs.logging.LogParameterUtil.getNonSpecialPropertiesMapParameters(), and alma.acs.logging.AcsLogger.offValue.
Referenced by alma.acs.container.AcsContainer.activate_component(), alma.acs.container.ContainerServicesImpl.activateOffShoot(), alma.acs.logging.AcsLogger.configureLevels(), alma.acs.logging.AcsLogger.configureLogging(), alma.alarmsystem.clients.CategoryClient.connect(), alma.acs.container.ComponentAdapter.deactivateComponent(), alma.acs.container.corba.AcsCorba.deactivateComponentPOAManager(), alma.alarmsystem.corbaservice.AlarmSystemContainerServices.deactivateOffShoot(), alma.acs.container.corba.AcsCorba.deactivateOffShoot(), alma.acs.container.AcsContainer.disconnect(), alma.acs.genfw.runtime.sm.AcsDoActivity.execute(), alma.acs.container.ContainerServicesImpl.findComponents(), alma.acs.container.ContainerServicesImpl.fireComponentsAvailable(), alma.acs.container.ContainerServicesImpl.fireComponentsUnavailable(), 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.AcsContainerRunner.initAcsLogging(), alma.acs.container.corba.AcsCorba.initCorba(), alma.acs.container.corba.AcsCorba.initCorbaForClient(), alma.acs.container.AcsContainer.initialize(), alma.acs.component.client.ComponentClient.initRemoteLogging(), alma.acs.logging.RepeatGuardLogger.log(), alma.acs.logging.domainspecific.ArrayContextLogger.log(), alma.acs.logging.domainspecific.AntennaContextLogger.log(), alma.acs.genfw.runtime.sm.AcsDoActivity.logActionFailure(), alma.acs.logging.AcsLogger.logToAudience(), alma.acs.alarmsystem.corbaservice.AlarmServiceUtils.main(), alma.acs.container.AcsContainer.refresh_logging_config(), alma.acs.container.ContainerServicesImpl.releaseComponent(), com.cosylab.cdb.jdal.HibernateServer.run(), alma.acs.alarmsystem.corbaservice.AlarmSystemCorbaServer.run(), alma.acs.component.client.ComponentClientTestCase.runTest(), alma.acs.container.corba.AcsCorba.setServantManagerOnComponentPOA(), alma.acs.component.client.ComponentClientTestCase.setUp(), alma.acs.commandcenter.meta.Firestarter.shutdown(), alma.acs.alarmsystem.corbaservice.AlarmSystemCorbaServer.shutdown(), and alma.acs.container.AcsContainer.shutdown().
void alma.acs.logging.AcsLogger.logToAudience | ( | Level | level, | |
String | msg, | |||
String | audience | |||
) |
The audience strings allowed in alma are defined in IDL, but are available as type-safe enums in alma.acs.logging.domainspecific.AudienceLogger, which thus should be preferred over this generic method.
References alma.acs.logging.AcsLogger.createAcsLogRecord(), alma.acs.logging.AcsLogger.log(), and alma.acs.logging.AcsLogRecord.setAudience().
Referenced by alma.acs.logging.domainspecific.AudienceLogger.config(), alma.acs.logging.domainspecific.AudienceLogger.fine(), alma.acs.logging.domainspecific.AudienceLogger.finer(), alma.acs.logging.domainspecific.AudienceLogger.finest(), alma.acs.logging.domainspecific.AudienceLogger.info(), alma.acs.logging.domainspecific.AudienceLogger.log(), alma.acs.logging.domainspecific.AudienceLogger.severe(), and alma.acs.logging.domainspecific.AudienceLogger.warning().
void alma.acs.logging.AcsLogger.logToAudience | ( | Level | level, | |
String | msg, | |||
Throwable | thr, | |||
String | audience | |||
) |
The audience strings allowed in alma are defined in IDL, but are available as type-safe enums in alma.acs.logging.domainspecific.AudienceLogger, which thus should be preferred over this generic method.
References alma.acs.logging.AcsLogger.createAcsLogRecord(), alma.acs.logging.AcsLogger.log(), and alma.acs.logging.AcsLogRecord.setAudience().
void alma.acs.logging.AcsLogger.setLoggerName | ( | String | newLoggerName | ) | [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 LogRecord
s 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 alma.acs.logging.AcsLogger.configureLogging(), alma.acs.logging.AcsLogger.getLoggerName(), and alma.acs.logging.config.LogConfig.renameNamedLoggerConfig().
Referenced by alma.acs.logging.ClientLogManager.prepareRemoteLogging().
void alma.acs.logging.AcsLogger.setProcessName | ( | String | processName | ) | [package] |
void alma.acs.logging.AcsLogger.setSourceObject | ( | String | sourceObject | ) | [package] |
final Logger alma.acs.logging.AcsLogger.delegate [protected] |
Usually this is null, but factory method wrapJdkLogger(Logger) could supply this delegate.
Referenced by alma.acs.logging.AcsLogger.log().
final int alma.acs.logging.AcsLogger.offValue = Level.OFF.intValue() [static, protected] |
Referenced by alma.acs.logging.AcsLogger.log().