The log Object
You can keep track of exactly what happened during your code's execution by having log arbitrary strings by using the log object. sends logs to the log object, which has a logging level. This logging level determines whether logging calls results in logging. If the logging level for the log object is higher than the logging call's logging level, then the logging call does not result in logging.
calac41
You can keep track of exactly what happened during your code's execution by having
CA Live API Creator
log arbitrary strings by using the log
object. CA Live API Creator
sends logs to the log
object, which has a logging level. This logging level determines whether logging calls results in logging. If the logging level for the log
object is higher than the logging call's logging level, then the logging call does not result in logging.In the following example, the call does not result in logging because the logging level for the
log
object is info
, which is lower than the logging level for the logging calls, which is warn
:log.info("My informational message");
In this article:
error Method
Use the
error()
method to log messages at the error level. If the logging level is at or below the error level, then CA Live API Creator
outputs the following message:log.error("This is a log error message");
warning Method
Use the
warning()
method to log messages at the warning level. If the logging level is at or below the warning level, then CA Live API Creator
outputs the following message:log.warning("This is a log warning message");
info Method
Use the
info()
method to log messages at the info level. If the logging level is at or below the info level, then CA Live API Creator
outputs the following message:log.info("This is a log info message");
debug Method
Use the
debug()
method to log messages at the debug level. If the logging level is at or below the debug level, then CA Live API Creator
outputs the following message:log.debug("This is a log debug message");
Logging can affect
CA Live API Creator
performance, particularly if logging requires executing code that takes up a lot of resources. It is generally a good idea to log no more than required. Logging a fixed message using the log.debug()
method is a low-resource option.finer Method
Use the
finer()
method to log messages at the finer level. If the logging level is at or below the finer level, then CA Live API Creator
outputs the following message:log.finer("This is a log finer message");
finest Method
Use the
finest()
method to log messages at the finest level. If the logging level is at or below the finest level, then CA Live API Creator
outputs the following message:log.finest("This is a log finest message");
isWarnEnabled Method
Use the
isWarnEnabled()
method to return true if the logging level is set to the warning level or higher.isInfoEnabled Method
Use the
method to return true if the logging level is set to the info level or higher.isWarnEnabled()
isDebugEnabled Method
Use the
isDebugEnabled()
method to return true if the logging level is set to the debug level or higher.If your logging message invokes other functions, or builds up a string from other objects, conditionalalize the logging message on the logging level, for example, using the
log.isDebugEnabled()
method:if (log.isDebugEnabled()) { log.debug("The value of foo is:" + foo.getValue() + " and the value of bar is:" + bar);}
If you do not make the logging conditional on the logging level and you turn down the logging level, you still incur the cost of building this string, even though it is never actually logged.
isFinerEnabled Method
Use the
isFinerEnabled()
method to return true if the logging level is set to the finer level or higher.isFinestEnabled Method
Use the
isFinestEnabled()
method to return true if the logging level is set to the finest level or higher.