Getting started with Log.apex
Log Information
Log.apex supports these log levels:
- Error
- Warn
- Info
- Debug
- Trace
You can use any of these logging levels to print the log information.
logger.debug('Debug message');
Or you can pass in parameters:
logger.debug('Debug {0}', 'message');
Or you can check it for performance's sake.
if(logger.isDebugEnabled()) {
logger.debug('Debug {0}', 'message');
}
However, with logging level Error, you need to provide the exception.
try {
// ...
}
catch(Exception ex) {
logger.error('some error', ex);
}