public interface AuditLog
Provides audit logging capabilities. Each log statement has a different level of importance or purpose, debug, warning, or error in that order. These statements will only be seen in the log if the process is invoked with a level equal to or greater than that statement.
For example, if a statement is logged at the debug level and the process is invoked at the error level, that statement will not appear. But if a statement is logged at the warning level and the process is invoked at the debug level it will appear.
To log at the debug level you would write:
auditLog.debug("my debug statement");
To log at the warning level you would write:
auditLog.warn("my warning statement");
To log at the error level you would write:
auditLog.error("my error statement");
Creating a log statement can be expensive in relation to the processing time of a message if you are concatenating strings and evaluating expressions to generate statement content. You can avoid this unnecessary overhead by not executing the call to the log if the log level is not applicable. This can be done by checking the current log level of the process before making the logging call as in the following:
if (auditLog.isDebugEnabled()) { auditLog.debug("Debugging var1 [" + var1 + "] and var2 [" + var2 + "]"); }
Modifier and Type | Method and Description |
---|---|
void |
debug(java.lang.String text)
Convenience method for logging a debug message.
|
void |
error(java.lang.String text)
Convenience method for logging a debug message.
|
boolean |
isDebugEnabled()
Is debug logging currently enabled?
|
boolean |
isErrorEnabled()
Is error logging currently enabled?
|
boolean |
isWarnEnabled()
Is warn logging currently enabled?
|
void |
warn(java.lang.String text)
Convenience method for logging a debug message.
|
boolean isDebugEnabled()
Is debug logging currently enabled?
Call this method to prevent having to perform expensive operations
(for example, String
concatenation)
when the log level is more than debug.
boolean isErrorEnabled()
Is error logging currently enabled?
Call this method to prevent having to perform expensive operations
(for example, String
concatenation)
when the log level is more than error.
boolean isWarnEnabled()
Is warn logging currently enabled?
Call this method to prevent having to perform expensive operations
(for example, String
concatenation)
when the log level is more than warn.
void debug(java.lang.String text)
text
- Raw String message to debug.void warn(java.lang.String text)
text
- Raw String message to debug.void error(java.lang.String text)
text
- Raw String message to debug.?? 2022 Perforce Software, All rights reserved
This software is the confidential and proprietary information of Perforce, Inc. and is subject to copyright protection under laws of the United States of America and other countries. The use of this software should be in accordance with the license agreement terms you entered into with Perforce, Inc.