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 | |
AcsLogger | createUnconfiguredLogger (String name, String resourceBundleName) |
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 | |
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") |
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.
|
Standard constructor that configures this logger from
|
|
Auxiliary ctor. Don't use it directly from outside of this class.
|
|
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.
|
|
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.
|
|
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.
|
|
Extracted from configureLogging(LogConfig) to support also configuration of Loggers created with createUnconfiguredLogger(String, String) which do not know about a shared LogConfig.
|
|
Callback method, configures this logger from the data in logConfig. |
|
|
|
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.
|
|
Client applications that use ACS class
If
|
|
|
|
|
|
|
|
Logs the given Adding of context information:
|
|
|
|
|
|
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
|
|
|
|
|
|
Concatenation of class and method names, with a "#" in between. Used for fast comparison of log stack frames, see addIgnoreLogs(String, String). |
|
|
|
Usually this is null, but factory method wrapJdkLogger(Logger) could supply this delegate. |
|
Configuration data. May be
|
|
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. |
|
|
|
|
|
|
|
|
|
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. |