public class DefaultConnectorLogger extends ConnectorLogger
It adds some extra configuration to allow the configuration of the log
output through the standard output (console), to be written in a file
(file) or both at the same time (both).
This parameter and the rest of the configuration for the logger are read
from the record store or from the Cloud Connector configuration file
(connector_config.txt) using the methods in the class
PreferencesManager.
Some of the logger parameters are defined in the
PreferencesConstants class.
If any other method or strategy is going to be provided to get/set the
values, this class might be extended to override the methods
getParameterValue(java.lang.String) and setParameterValue(java.lang.String, java.lang.String).
ConnectorLogger,
PreferencesConstants,
PreferencesManager| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
LOG_BOTH
Log messages will be sent to the standard output and to a log file as
described for
LOG_FILE. |
static java.lang.String |
LOG_CONSOLE
Log messages will be sent to the standard output.
|
static java.lang.String |
LOG_FILE
Log messages will be sent to a file located in the 'storage_dir' property.
|
static java.lang.String |
LOG_TAG
'Log tag' setting name: "log_tag".
|
static java.lang.String |
PARAM_LOG_OUTPUT
'Log output' setting name: "log_output".
|
| Constructor and Description |
|---|
DefaultConnectorLogger(PreferencesManager preferencesManager)
Class constructor.
|
DefaultConnectorLogger(PreferencesManager preferencesManager,
java.lang.String configFile)
Class constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getLogFilePath()
Returns the log file path.
|
java.lang.String |
getParameterValue(java.lang.String parameter)
Retrieves the value of the given parameter name.
|
boolean |
isLoggingToConsole()
Returns
true if logging to console, false otherwise. |
boolean |
isLoggingToFile()
Returns
true if logging to file, false otherwise. |
boolean |
logConnectionEvents()
Retrieves whether connection events should be logged or not.
|
boolean |
logDataPointEvents()
Retrieves whether data point events should be logged or not.
|
boolean |
logDataPushEvents()
Retrieves whether data push events should be logged or not.
|
boolean |
logDebugMessages()
Retrieves whether to log debug level messages or not.
|
boolean |
logDeviceRequestEvents()
Retrieves whether device request events should be logged or not.
|
boolean |
logErrorMessages()
Retrieves whether to log error level messages or not.
|
void |
logException(java.lang.Exception e)
Logs the given exception.
|
boolean |
logExceptions()
Retrieves whether to log exceptions or not.
|
boolean |
logFileSystemEvents()
Retrieves whether file system events should be logged or not.
|
boolean |
logFirmwareEvents()
Retrieves whether firmware events should be logged or not.
|
boolean |
logInformationMessages()
Retrieves whether to log information level messages or not.
|
boolean |
logPackets()
Retrieves whether to log EDP packets or not.
|
boolean |
logRCIEvents()
Retrieves whether RCI events should be logged or not.
|
boolean |
logSystemEvents()
Retrieves whether system events should be logged or not.
|
void |
setParameterValue(java.lang.String parameter,
java.lang.String value)
Sets the given parameter value.
|
void |
stopLogging()
Stops logging.
|
getInstance, logEvent, logSystemDebug, logSystemError, logSystemInfopublic static final java.lang.String LOG_BOTH
LOG_FILE.
The value of this constant is "both".
PARAM_LOG_OUTPUT,
LOG_CONSOLE,
LOG_FILE,
Constant Field Valuespublic static final java.lang.String LOG_CONSOLE
The value of this constant is "console".
PARAM_LOG_OUTPUT,
LOG_FILE,
LOG_BOTH,
Constant Field Valuespublic static final java.lang.String LOG_FILE
The value of this constant is "file".
PARAM_LOG_OUTPUT,
LOG_CONSOLE,
LOG_BOTH,
Constant Field Valuespublic static final java.lang.String LOG_TAG
Identifies the instance of the Cloud Connector in the log messages.
This setting is useful if the application is going to run multiple instances of the Cloud Connector concurrently.
public static final java.lang.String PARAM_LOG_OUTPUT
LOG_CONSOLE,
LOG_FILE,
LOG_BOTH,
Constant Field Valuespublic DefaultConnectorLogger(PreferencesManager preferencesManager)
preferencesManager - the preferences manager to get and set the
value of the logger settings, if
null the default configuration for the
logger will be used.public DefaultConnectorLogger(PreferencesManager preferencesManager, java.lang.String configFile)
preferencesManager - the preferences manager to get and set the
value of the logger settings, if
null the default configuration for the
logger will be used.configFile - Path of the Cloud Connector configuration file.public java.lang.String getLogFilePath()
null if not logging to a file.public java.lang.String getParameterValue(java.lang.String parameter)
parameter - the parameter name to get its value.null if not found.public boolean isLoggingToConsole()
true if logging to console, false otherwise.true if logging to console, false otherwise.public boolean isLoggingToFile()
true if logging to file, false otherwise.true if logging to file, false otherwise.public boolean logConnectionEvents()
ConnectorLoggerlogConnectionEvents in class ConnectorLoggertrue if connection events should be logged, false
otherwise.public boolean logDataPointEvents()
ConnectorLoggerlogDataPointEvents in class ConnectorLoggertrue if data point events should be logged,
false otherwise.public boolean logDataPushEvents()
ConnectorLoggerlogDataPushEvents in class ConnectorLoggertrue if data push events should be logged, false
otherwise.public boolean logDebugMessages()
ConnectorLoggerlogDebugMessages in class ConnectorLoggertrue to log debug level messages, false
otherwise.public boolean logDeviceRequestEvents()
ConnectorLoggerlogDeviceRequestEvents in class ConnectorLoggertrue if device request events should be logged,
false otherwise.public boolean logErrorMessages()
ConnectorLoggerlogErrorMessages in class ConnectorLoggertrue to log error level messages, false
otherwise.public void logException(java.lang.Exception e)
ConnectorLoggerlogException in class ConnectorLoggere - Exception to log.public boolean logExceptions()
ConnectorLoggerlogExceptions in class ConnectorLoggertrue to log exceptions, false otherwise.public boolean logFileSystemEvents()
ConnectorLoggerlogFileSystemEvents in class ConnectorLoggertrue if file system events should be logged,
false otherwise.public boolean logFirmwareEvents()
ConnectorLoggerlogFirmwareEvents in class ConnectorLoggertrue if firmware events should be logged, false
otherwise.public boolean logInformationMessages()
ConnectorLoggerlogInformationMessages in class ConnectorLoggertrue to log information level messages, false
otherwise.public boolean logPackets()
ConnectorLoggerlogPackets in class ConnectorLoggertrue to log EDP packets, false otherwise.public boolean logRCIEvents()
ConnectorLoggerlogRCIEvents in class ConnectorLoggertrue if RCI events should be logged, false
otherwise.public boolean logSystemEvents()
ConnectorLoggerlogSystemEvents in class ConnectorLoggertrue if system events should be logged, false
otherwise.public void setParameterValue(java.lang.String parameter,
java.lang.String value)
parameter - The parameter name to be configured.value - A string that represents the value of the given parameter.public void stopLogging()
This method closes the log file streams and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.
© Copyright 2014 Etherios, Inc. All rights reserved. Etherios, Inc. is a Division of Digi International Inc.