alma::acs::logging::AcsLogLevel Class Reference

Inheritance diagram for alma::acs::logging::AcsLogLevel:
Inheritance graph
[legend]
Collaboration diagram for alma::acs::logging::AcsLogLevel:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 AcsLogLevel (String name, int value, AcsLogLevelDefinition acsCoreLevel)
AcsLogLevelDefinition getAcsLevel ()
String getEntryName ()
int compareTo (AcsLogLevel l)

Static Public Member Functions

static AcsLogLevel fromAcsCoreLevel (AcsLogLevelDefinition acsCoreLevel)
static Level getLowestMatchingJdkLevel (AcsLogLevelDefinition acsCoreLevel)
static AcsLogLevel getNativeLevel (Level level)

Static Public Attributes

static final AcsLogLevel TRACE = new AcsLogLevel("TRACE", Level.FINEST.intValue(), AcsLogLevelDefinition.TRACE)
static final AcsLogLevel DEBUG = new AcsLogLevel("DEBUG", Level.CONFIG.intValue(), AcsLogLevelDefinition.DEBUG)
static final AcsLogLevel INFO = new AcsLogLevel("INFO", Level.INFO.intValue(), AcsLogLevelDefinition.INFO)
static final AcsLogLevel NOTICE = new AcsLogLevel("NOTICE", 801, AcsLogLevelDefinition.NOTICE)
static final AcsLogLevel WARNING = new AcsLogLevel("WARNING", Level.WARNING.intValue(), AcsLogLevelDefinition.WARNING)
static final AcsLogLevel ERROR = new AcsLogLevel("ERROR", 901, AcsLogLevelDefinition.ERROR)
static final AcsLogLevel CRITICAL = new AcsLogLevel("CRITICAL", 902, AcsLogLevelDefinition.CRITICAL)
static final AcsLogLevel ALERT = new AcsLogLevel("ALERT", 903, AcsLogLevelDefinition.ALERT)
static final AcsLogLevel EMERGENCY = new AcsLogLevel("EMERGENCY", Level.SEVERE.intValue(), AcsLogLevelDefinition.EMERGENCY)
static final AcsLogLevel OFF = new AcsLogLevel(Level.OFF.getName(), Level.OFF.intValue(), AcsLogLevelDefinition.OFF)

Static Package Functions

static void printMappings (PrintStream ps)

Private Attributes

final AcsLogLevelDefinition acsCoreLevel
String entryName = null

Static Private Attributes

static final String ACS_BUNDLE_NAME = AcsLogLevel.class.getPackage().getName()
static TreeSet< AcsLogLevelknown = new TreeSet<AcsLogLevel>()
static Map< Level, AcsLogLevellookup = new HashMap<Level, AcsLogLevel>()

Detailed Description

Defines ACS specific logging levels. Also provides non-ACS level, which includes set of standard logging and possibly other vendor levels, to ACS level mapping. Maps Java-specific levels to ACS specific levels.

Although an OFF level is not mentioned in the Acs documentation, it is included for the purpose of dealing with bad levels as well as of blocking logging.

Author:
Matej Sekoranja (matej.sekoranja@cosylab.com)
Version:
@VERSION@

Constructor & Destructor Documentation

alma::acs::logging::AcsLogLevel::AcsLogLevel ( String  name,
int  value,
AcsLogLevelDefinition  acsCoreLevel 
) [inline]

Create a named Level with a given integer value.

Parameters:
name the name of the Level, for example "INFO".
value an integer value for the level.

References ACS_BUNDLE_NAME, entryName, known, and lookup.


Member Function Documentation

int alma::acs::logging::AcsLogLevel::compareTo ( AcsLogLevel  l  )  [inline]

Compares the level with the specified level for order.

See also:
java.lang.Comparable::compareTo(Object)
static AcsLogLevel alma::acs::logging::AcsLogLevel::fromAcsCoreLevel ( AcsLogLevelDefinition  acsCoreLevel  )  [inline, static]

Converts an ACS core log level (small integer as defined in ACS IDL) to the largest matching AcsLogLevel.

References getAcsLevel(), and known.

Referenced by alma::contLogTest::TestLogLevelsCompImpl::TestLogLevelsCompImpl::logDummyMessages().

AcsLogLevelDefinition alma::acs::logging::AcsLogLevel::getAcsLevel (  )  [inline]

Returns the corresponding ACS core level, which is a small positive integer defined as "priority" in the ACS logging and archiving architecture document and coded in IDL (see alma.AcsLogging.alma.LogLevels.WARNING_NAME and similar constants).

This level is different from the JDK-style level, which can be any integer.

Returns:
ACS core level

References acsCoreLevel.

Referenced by alma::acs::logging::formatters::AcsXMLLogFormatter::format(), alma::acs::logging::formatters::AcsBinLogFormatter::formatBinary(), fromAcsCoreLevel(), alma::contLogTest::TestLogLevelsCompImpl::TestLogLevelsCompImpl::getLevels(), and printMappings().

String alma::acs::logging::AcsLogLevel::getEntryName (  )  [inline]

Returns the ACS XML level entryName.

Returns:
ACS XML level entryName

References entryName.

Referenced by alma::acs::logging::formatters::AcsXMLLogFormatter::format(), and printMappings().

static Level alma::acs::logging::AcsLogLevel::getLowestMatchingJdkLevel ( AcsLogLevelDefinition  acsCoreLevel  )  [inline, static]

Converts an ACS core log level (small integer as defined in ACS IDL) to the lowest matching AcsLogLevel or JDK Level.

Note the difference to fromAcsCoreLevel(AcsLogLevelDefinition):

  • If more than one JDK-style log level gets mapped to the given core level, then the lowest of these levels gets returned. This method is therefore suitable to compute JDK log levels for filtering when logs with all matching JDK levels should be allowed.
  • Currently this method is implemented with hard-wired levels, which means that user-defined subclasses of AcsLogLevel are not considered. (As of ACS 8.x, there is no known usage of custom log levels. Supporting them for this method would require to keep a list similar to known that includes all JDK Level and AcsLogLevel objects.)

References ALERT, CRITICAL, DEBUG, EMERGENCY, ERROR, INFO, NOTICE, OFF, TRACE, and WARNING.

static AcsLogLevel alma::acs::logging::AcsLogLevel::getNativeLevel ( Level  level  )  [inline, static]

Maps any (JDK or ACS) level to an ACS native level.

Parameters:
level any level
Returns:
native level, can be null if no native level is found or if level==Level.OFF

References known, and lookup.

Referenced by alma::contLogTest::TestLogLevelsCompImpl::TestLogLevelsCompImpl::getLevels().

static void alma::acs::logging::AcsLogLevel::printMappings ( PrintStream  ps  )  [inline, static, package]

This method should only be used to generate documentation about the various level mappings in use.

Parameters:
ps The PrintStream to print to, e.g. System.out

References getAcsLevel(), getEntryName(), and known.


Member Data Documentation

final String alma::acs::logging::AcsLogLevel::ACS_BUNDLE_NAME = AcsLogLevel.class.getPackage().getName() [static, private]

The resource bundle name to be used in localizing ACS level name.

Referenced by AcsLogLevel().

final AcsLogLevelDefinition alma::acs::logging::AcsLogLevel::acsCoreLevel [private]

The ACS error system defined level (small integer) which this JDK-style level maps to

Referenced by getAcsLevel().

final AcsLogLevel alma::acs::logging::AcsLogLevel::ALERT = new AcsLogLevel("ALERT", 903, AcsLogLevelDefinition.ALERT) [static]

A condition that should be corrected immediately, such as a corrupted system database. TODO: use something like 980 instead of 903 to allow other levels between ERROR and ALERT

Referenced by getLowestMatchingJdkLevel(), and alma::acs::jlog::test::LongRunTest::publishLogsBlock().

final AcsLogLevel alma::acs::logging::AcsLogLevel::CRITICAL = new AcsLogLevel("CRITICAL", 902, AcsLogLevelDefinition.CRITICAL) [static]

Critical conditions, such as hard device errors. TODO: use something like 960 instead of 902 to allow other levels between CRITICAL and ERROR

Referenced by getLowestMatchingJdkLevel(), and alma::acs::jlog::test::LongRunTest::publishLogsBlock().

final AcsLogLevel alma::acs::logging::AcsLogLevel::DEBUG = new AcsLogLevel("DEBUG", Level.CONFIG.intValue(), AcsLogLevelDefinition.DEBUG) [static]

Messages that contain information normally of use only when debugging a program.

Referenced by getLowestMatchingJdkLevel(), and alma::acs::jlog::test::LongRunTest::publishLogsBlock().

final AcsLogLevel alma::acs::logging::AcsLogLevel::EMERGENCY = new AcsLogLevel("EMERGENCY", Level.SEVERE.intValue(), AcsLogLevelDefinition.EMERGENCY) [static]

A panic condition. This is normally broadcast to all users.

Referenced by getLowestMatchingJdkLevel(), and alma::acs::jlog::test::LongRunTest::publishLogsBlock().

XML Entry name.

Referenced by AcsLogLevel(), and getEntryName().

final AcsLogLevel alma::acs::logging::AcsLogLevel::ERROR = new AcsLogLevel("ERROR", 901, AcsLogLevelDefinition.ERROR) [static]

Error messages. TODO: use something like 930 instead of 901 to allow other levels between ERROR and WARNING

Referenced by getLowestMatchingJdkLevel(), and alma::acs::jlog::test::LongRunTest::publishLogsBlock().

final AcsLogLevel alma::acs::logging::AcsLogLevel::INFO = new AcsLogLevel("INFO", Level.INFO.intValue(), AcsLogLevelDefinition.INFO) [static]
TreeSet<AcsLogLevel> alma::acs::logging::AcsLogLevel::known = new TreeSet<AcsLogLevel>() [static, private]

List of all ACS levels, sorted automatically with lowest log level first.

Referenced by AcsLogLevel(), fromAcsCoreLevel(), getNativeLevel(), and printMappings().

Map<Level, AcsLogLevel> alma::acs::logging::AcsLogLevel::lookup = new HashMap<Level, AcsLogLevel>() [static, private]

Fast lookup table mapping.

Referenced by AcsLogLevel(), and getNativeLevel().

final AcsLogLevel alma::acs::logging::AcsLogLevel::NOTICE = new AcsLogLevel("NOTICE", 801, AcsLogLevelDefinition.NOTICE) [static]

Conditions that are not error conditions, but that may require special handling. TODO: use something like 850 instead of 801 to allow other levels between INFO and NOTICE

Referenced by getLowestMatchingJdkLevel(), and alma::acs::jlog::test::LongRunTest::publishLogsBlock().

final AcsLogLevel alma::acs::logging::AcsLogLevel::OFF = new AcsLogLevel(Level.OFF.getName(), Level.OFF.intValue(), AcsLogLevelDefinition.OFF) [static]

Level not to be used for actual logging, but to set log levels for filtering. Overwrites/hides Level.OFF.

Referenced by getLowestMatchingJdkLevel().

final AcsLogLevel alma::acs::logging::AcsLogLevel::TRACE = new AcsLogLevel("TRACE", Level.FINEST.intValue(), AcsLogLevelDefinition.TRACE) [static]

Messages indicating function-calling sequence. Messages indicating function-calling sequence.

Referenced by getLowestMatchingJdkLevel().

final AcsLogLevel alma::acs::logging::AcsLogLevel::WARNING = new AcsLogLevel("WARNING", Level.WARNING.intValue(), AcsLogLevelDefinition.WARNING) [static]

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

Generated by  doxygen 1.6.2