Class DermisLogger
- java.lang.Object
-
- com.adobe.aemfd.dermis.authentication.exception.DermisLogger
-
public class DermisLogger extends java.lang.Object
Class to get a pre-defined message from a exceptions.properties file in this library
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BUNDLE_NAME
static int
LOG_DEBUG
static int
LOG_ERROR
static int
LOG_FATAL
static int
LOG_INFO
static int
LOG_TRACE
static int
LOG_WARN
static java.lang.String
PERF_END
static java.lang.String
PERF_START
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addResourceBundle(java.lang.String key, java.util.ResourceBundle resourceBundle)
Add Resource bundle to mapstatic void
endPerformTimer(java.lang.String message)
Stops a timer that was previously started by calling DermisLogger.startPerformTimer().static java.lang.String
getString(java.lang.String key)
Retrieve message with default locale (en_EN) If given key isn't found in the resources, returns the original keystatic java.lang.String
getString(java.lang.String resourceID, java.lang.String[] args)
Retrieve message with default locale (en_EN) for the given resourceID and arguments.static void
logAuditMessage(java.lang.Class class1, java.lang.String message, java.lang.String[] arguments)
Log message at the DEBUG level - This is for audit purposes.static void
logErrorAndDebug(java.lang.Class clazz, java.lang.String errorMsg, java.lang.Exception e)
Logs the given string at error level and a given string plus the given cause at debug level This method should be used for logging when the underlying exception may contain user data as no user data should be logged at above debug levelstatic void
logErrorAndDebug(java.lang.Class clazz, java.lang.String errorMsg, java.lang.String debugMsg)
Logs the given error and debug message at error and debug level respectively This method should be used for logging when we want to log message containing user data as no user data should be logged at above debug levelstatic void
logMessage(java.lang.Class class1, int severity, java.lang.String resourceID)
Log message at the given severity level, against the given resourceID.static void
logMessage(java.lang.Class class1, int severity, java.lang.String resourceID, java.lang.String[] args)
Log message at the given severity level, against the given resourceID and arguments.static void
logMessage(java.lang.Class class1, int severity, java.lang.String resourceID, java.lang.String[] args, java.lang.Throwable cause)
Log message at the given severity level, against the given resourceID and arguments.static long
logPerformance(java.lang.Class class1, java.lang.String message, java.lang.String[] arguments, boolean diff, long timeStamp)
Log message at the TRACE level - This is for performance logging purposes.static java.lang.String
replaceString(java.lang.String message, java.lang.String[] args)
static void
startPerformTimer(java.lang.String message)
Starts a timer which can be used to track how long an operation takes.
-
-
-
Field Detail
-
LOG_FATAL
public static final int LOG_FATAL
- See Also:
- Constant Field Values
-
LOG_ERROR
public static final int LOG_ERROR
- See Also:
- Constant Field Values
-
LOG_WARN
public static final int LOG_WARN
- See Also:
- Constant Field Values
-
LOG_INFO
public static final int LOG_INFO
- See Also:
- Constant Field Values
-
LOG_DEBUG
public static final int LOG_DEBUG
- See Also:
- Constant Field Values
-
LOG_TRACE
public static final int LOG_TRACE
- See Also:
- Constant Field Values
-
BUNDLE_NAME
public static final java.lang.String BUNDLE_NAME
- See Also:
- Constant Field Values
-
PERF_START
public static final java.lang.String PERF_START
- See Also:
- Constant Field Values
-
PERF_END
public static final java.lang.String PERF_END
- See Also:
- Constant Field Values
-
-
Method Detail
-
addResourceBundle
public static void addResourceBundle(java.lang.String key, java.util.ResourceBundle resourceBundle)
Add Resource bundle to map- Parameters:
key
-resourceBundle
-
-
getString
public static java.lang.String getString(java.lang.String key)
Retrieve message with default locale (en_EN) If given key isn't found in the resources, returns the original key- Parameters:
key
- key of message- Returns:
- the translated resource string
-
logMessage
public static void logMessage(java.lang.Class class1, int severity, java.lang.String resourceID, java.lang.String[] args)
Log message at the given severity level, against the given resourceID and arguments.- Parameters:
class1
- Class for the loggerseverity
- severity of the logresourceID
- resource bundle identifierargs
- necessary arguments for the error message
-
logMessage
public static void logMessage(java.lang.Class class1, int severity, java.lang.String resourceID, java.lang.String[] args, java.lang.Throwable cause)
Log message at the given severity level, against the given resourceID and arguments.- Parameters:
class1
- Class for the loggerseverity
- severity of the logresourceID
- resource bundle identifierargs
- necessary arguments for the error messagecause
- root cause of exception
-
logMessage
public static void logMessage(java.lang.Class class1, int severity, java.lang.String resourceID)
Log message at the given severity level, against the given resourceID.- Parameters:
class1
- Class for the loggerseverity
- severity of the logresourceID
- resource bundle identifier
-
logAuditMessage
public static void logAuditMessage(java.lang.Class class1, java.lang.String message, java.lang.String[] arguments)
Log message at the DEBUG level - This is for audit purposes.- Parameters:
class1
- Class for the loggermessage
- Message to be loggedarguments
- necessary arguments for the audit message
-
logPerformance
public static long logPerformance(java.lang.Class class1, java.lang.String message, java.lang.String[] arguments, boolean diff, long timeStamp)
Log message at the TRACE level - This is for performance logging purposes.- Parameters:
class1
- Class for the loggermessage
- Message to be loggedarguments
- necessary arguments for the audit messagediff
- necessary to indicate if the message is beginning or end of performance log
-
startPerformTimer
public static void startPerformTimer(java.lang.String message)
Starts a timer which can be used to track how long an operation takes. Each timer have a unique name, and may have up to 100 timers running at time. When you call DermisLogger.endPerformTimer() with the same name, the program will output the time, in milliseconds, that elapsed since the timer was started.- Parameters:
message
- The name to give the new timer. This will identify the timer; use the same name when calling ermisLogger.endPerformTimer() to stop the timer and print the output in log of type trace.
-
endPerformTimer
public static void endPerformTimer(java.lang.String message)
Stops a timer that was previously started by calling DermisLogger.startPerformTimer().- Parameters:
message
- The name of the timer to stop. Once stopped, the elapsed time is automatically logged into log file of type trace.
-
getString
public static java.lang.String getString(java.lang.String resourceID, java.lang.String[] args)
Retrieve message with default locale (en_EN) for the given resourceID and arguments.- Parameters:
resourceID
- resource bundle identifierargs
- necessary arguments for the error message- Returns:
- the translated resource string
-
replaceString
public static java.lang.String replaceString(java.lang.String message, java.lang.String[] args)
-
logErrorAndDebug
public static void logErrorAndDebug(java.lang.Class clazz, java.lang.String errorMsg, java.lang.Exception e)
Logs the given string at error level and a given string plus the given cause at debug level This method should be used for logging when the underlying exception may contain user data as no user data should be logged at above debug level- Parameters:
clazz
- Class for the loggererrorMsg
- The string to be logged as errore
- The actual exception
-
logErrorAndDebug
public static void logErrorAndDebug(java.lang.Class clazz, java.lang.String errorMsg, java.lang.String debugMsg)
Logs the given error and debug message at error and debug level respectively This method should be used for logging when we want to log message containing user data as no user data should be logged at above debug level- Parameters:
clazz
- Class for the loggererrorMsg
- The string to be logged as errordebugMsg
- The actual exception
-
-