Package | com.lightstreamer.as_client.logger |
Class | public class Logger |
Inheritance | Logger Object |
The flex client library internal logging is based on both the native mx.logging interface and the com.lightstreamer.as_client.logger interface. The Logger class is the logging engine directly supplied by the flex client library.
Library classes produce their log by sending messages both to Logger class instances and to native mx.logging.ILogger instances.
Each logger instance used is characterized by a name, while each log message has an associated level.
The library uses loggers with the following names:
for information on the streaming or polling connection state;
for information on the connection state for control requests;
for information on the management of the queue of control requests being issued to the Server;
for information on the management of the queue of destroy requests being issued to the Server;
for information on the management of the queue of message requests being issued to the Server;
for information on internal errors during internal task execution;
for information on general activities;
for information on the timed tasks behaviour;
for information on table settings and event flow;
for information on table settings and event flow;
for information on table settings and event flow specific for second level tables of tables configured in "MultiMetapush logic".
for information on a Message settings and event flow;
for information on the management of a Messages sequence;
for information on the management of Message sequences;
The available levels are DEBUG, INFO, WARN and ERROR.
In order to make this log available to the user, application code must create suitable listeners and add these listeners to the loggers of interest. For the Flex native interface, this is achieved through instances of mx.logging.ILoggerTarget, where filters on logger names and levels can be defined.
To achieve the same with the flex client library internal logging system, a suitable listener can be attached to a Logger instance. In order to collect the output from multiple loggers, a logger hierarchy is defined through the logger names. A logger is a son of another logger if its name is composed by the father's name plus a dot ( . ) plus a second part of the name (eg: "a.b.c" is son of "a.b" and "a" while it's not a son of "a.d"). Messages published on son loggers are also published on the father.
This is an example:
var traceAppender:TraceAppender = new TraceAppender(Logger.DEBUG); var logger:Logger = Logger.getLogger("com.lightstreamer.as_client"); logger.addLoggerListener(traceAppender);
in this case, all log produced by the library is published through the Flash trace method.
See also
Property | Defined By | ||
---|---|---|---|
DEBUG : uint = 0 [static]
DEBUG logging level
| Logger | ||
ERROR : uint = 15 [static]
ERROR logging level
| Logger | ||
INFO : uint = 5 [static]
INFO logging level
| Logger | ||
WARN : uint = 10 [static]
WARN logging level
| Logger |
Method | Defined By | ||
---|---|---|---|
Logger(name:String)
Constructor for Logger. | Logger | ||
addLoggerListener(listener:LoggerListener):void
Add a listener to the Logger instance. | Logger | ||
debug(mex:*):void
Publish a log message on the Logger object at DEBUG level. | Logger | ||
error(mex:*):void
Publish a log message on the Logger object at ERROR level. | Logger | ||
[static]
Logger factory that gets a logger related to a specified name. | Logger | ||
info(mex:*):void
Publish a log message on the Logger object at INFO level. | Logger | ||
log(level:uint, mex:*):void
Publish a log message on this Logger object. | Logger | ||
removeLoggerListener(listener:LoggerListener):Boolean
Remove a listener from the Logger instance. | Logger | ||
warn(mex:*):void
Publish a log message on the Logger object at WARN level. | Logger |
DEBUG | property |
public static var DEBUG:uint = 0
DEBUG logging level
ERROR | property |
public static var ERROR:uint = 15
ERROR logging level
INFO | property |
public static var INFO:uint = 5
INFO logging level
WARN | property |
public static var WARN:uint = 10
WARN logging level
Logger | () | Constructor |
public function Logger(name:String)
Constructor for Logger. This constructor should not be used, the static method getLogger should be used instead.
Parametersname:String — The name of the desired logger.
|
See also
addLoggerListener | () | method |
public function addLoggerListener(listener:LoggerListener):void
Add a listener to the Logger instance. Such listener will receive all the log lines from this logger and its sons. The listener also defines a threshold level, so that it will receive only the log lines with a level equal to or greater than the threshold.
Parameters
listener:LoggerListener — An instance of an object implementing the LoggerListener interface.
|
See also
debug | () | method |
public function debug(mex:*):void
Publish a log message on the Logger object at DEBUG level. The message is also published on an mx.logging.ILogger instance with the same name, using the corresponding level.
Parameters
mex:* — The message to be logged. It could be a String instance, an Error instance or any other
object, provided that it has a toString method.
|
See also
error | () | method |
public function error(mex:*):void
Publish a log message on the Logger object at ERROR level. The message is also published on an mx.logging.ILogger instance with the same name, using the corresponding level.
Parameters
mex:* — The message to be logged. It could be a String instance, an Error instance or any other
object, provided that it has a toString method.
|
See also
getLogger | () | method |
public static function getLogger(loggerName:String):Logger
Logger factory that gets a logger related to a specified name. If such logger does not exist it is created. A unique instance is always maintained for each logger name.
Parameters
loggerName:String — The name of the desired logger.
|
Logger — The desired Logger instance.
|
info | () | method |
public function info(mex:*):void
Publish a log message on the Logger object at INFO level. The message is also published on an mx.logging.ILogger instance with the same name, using the corresponding level.
Parameters
mex:* — The message to be logged. It could be a String instance, an Error instance or any other
object, provided that it has a toString method.
|
See also
log | () | method |
public function log(level:uint, mex:*):void
Publish a log message on this Logger object. The message is also published on an mx.logging.ILogger instance with the same name, using the corresponding level.
Parameters
level:uint — The logging level of the given message. It should be one of DEBUG INFO WARN ERROR
constants values. Specialized method are available as shortcuts to avoid to specify a logging level
| |
mex:* — The message to be logged. It could be a String instance, an Error instance or any other
object, provided that it has a toString method.
|
See also
removeLoggerListener | () | method |
public function removeLoggerListener(listener:LoggerListener):Boolean
Remove a listener from the Logger instance.
Parameters
listener:LoggerListener — An instance of an object implementing the LoggerListener interface
that was previously added to this same Logger.
|
Boolean — true if the given listener is correctly found and so removed, false otherwise.
|
See also
warn | () | method |
public function warn(mex:*):void
Publish a log message on the Logger object at WARN level. The message is also published on an mx.logging.ILogger instance with the same name, using the corresponding level.
Parameters
mex:* — The message to be logged. It could be a String instance, an Error instance or any other
object, provided that it has a toString method.
|
See also