public class AppLog extends Object
The AppLog class is a logging API for use by a BusinessApplicationPlugin
class.
Plug-in classes can record error, info and debug messages in the execute method. These messages
will be recorded in the Log4j log file (if that log level is enabled in the worker for the AppLog
class). The message will also be recorded in the module log file on the master if that log level
is enabled for the business application. This functionality allows viewing the logs for the
all the workers from the CPF admin console.
The plug-in must implement the following method on the BusinessApplicationPlugin
class
to obtain a AppLog instance for this request.
private AppLog appLog; public void setAppLog(final AppLog appLog) { this.appLog = appLog; }
Constructor and Description |
---|
AppLog(String name) |
AppLog(String name,
String logLevel) |
AppLog(String moduleName,
String businessApplicationName,
String groupId,
String logLevel) |
Modifier and Type | Method and Description |
---|---|
void |
debug(String message)
Record the info message in the log if
isInfoEnabled() is true. |
void |
error(String message)
Record the error message in the log.
|
void |
error(String message,
Throwable exception)
Record the error message in the log with the exception.
|
String |
getLogLevel()
Get the logging level (ERROR, INFO, DEBUG).
|
void |
info(String message)
Record the info message in the log if
isInfoEnabled() is true. |
boolean |
isDebugEnabled()
Check to see if debug level logging is enabled.
|
boolean |
isInfoEnabled()
Check to see if info or debug level logging is enabled.
|
void |
setLogLevel(String logLevel)
Set the current logging level (ERROR, INFO, DEBUG).
|
String |
toString() |
void |
warn(String message)
Record the warning message in the log.
|
public AppLog(String name)
public void debug(String message)
Record the info message in the log if isInfoEnabled()
is true.
message
- The message.public void error(String message)
Record the error message in the log.
message
- The message.public void error(String message, Throwable exception)
Record the error message in the log with the exception.
message
- The message.public String getLogLevel()
Get the logging level (ERROR, INFO, DEBUG).
public void info(String message)
Record the info message in the log if isInfoEnabled()
is true.
message
- The message.public boolean isDebugEnabled()
Check to see if debug level logging is enabled. Use this in an if block around logging operations that create large amounts of log data to prevent that data from being created if logging is not enabled.
public boolean isInfoEnabled()
Check to see if info or debug level logging is enabled. Use this in an if block around logging operations that create large amounts of log data to prevent that data from being created if logging is not enabled.
public void setLogLevel(String logLevel)
Set the current logging level (ERROR, INFO, DEBUG).
logLevel
- The logging level (ERROR, INFO, DEBUG).public void warn(String message)
Record the warning message in the log.
message
- The warning.Copyright © 2008–2017 Province of British Columbia. All rights reserved.