Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Package Functions

alma.acs.logging.AcsLogger Class Reference

Inheritance diagram for alma.acs.logging.AcsLogger:
alma.acs.logging.config.LogConfigSubscriber

List of all members.

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)

Detailed Description

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.

Author:
hsommer created May 30, 2005 4:09:47 PM

Constructor & Destructor Documentation

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.

Parameters:
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.

Parameters:
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().


Member Function Documentation

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.

Parameters:
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.

Parameters:
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.

Parameters:
loggerConfig 

References alma.acs.logging.AcsLogger.log().

Referenced by alma.acs.logging.AcsLogger.configureLogging(), and alma.acs.logging.ClientLogManager.getLoggerForApplication().

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!

Parameters:
name the logger's name
resourceBundleName 
Returns:
AcsLogger that is as close to a normal JDK Logger as possible.
Exceptions:
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.

Parameters:
logger the JDK logger
wrapperName Name of the returned AcsLogger. May be null in which case the delegate's name plus "wrapper" is taken.
Returns:
an AcsLogger that delegates to the given logger.
Since:
ACS 8.0

References alma.acs.logging.AcsLogger.AcsLogger().

Referenced by alma.acs.component.client.ComponentClient.ComponentClient().

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:

  • If the LogRecord has a parameter that is a map which contains additional information about the line of code, thread, etc., the log record will be taken as provided, and no context information will be added. This can be useful if
    • the log record was reconstructed from a remote error by the ACS error handling code (see AcsJException), or
    • if in very exceptional cases application code needs to manipulate such information by hand.
  • otherwise, context information is inferred, similar to LogRecord#inferCaller(), but additionally including thread name and line of code.

Note that by overloading this method, we intercept all logging activities of the base class.

See also:
java.util.logging.Logger.log(java.util.logging.LogRecord)

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,
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 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.

Parameters:
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]

Member Data Documentation

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]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties