Apex BOOST Library |
Description | The Logger's primary responsibility is to create Log (aBoost__Log__c) records. It utilizes immediate Platform Events to circumvent rollbacks that happen when an exception is thrown in a transaction. After calling Logger.log , you can be assured that the log record will be committed. In addition to the parameters you pass to a Logger.log method, Apex BOOST will record the context (class, method, line), current user, and stack trace. In addition to the logging calls you add to your Apex code, logs will be auto-generated (no Apex code changes required) in the following scenarios:
An additional benefit of Logger is that it can be turned on and off via hierarchical Apex BOOST custom settings. Just adjust the Log Level for any user or profile - even in production - to start creating log records in order to triage problems. Finally, once you've implemented logging, stakeholders will be able to build reports and workflow to visualize and be notified of errors occurring in the system. Usage:public class MyClass { public void myMethod() { // ERROR|scox~ MyClass.myMethod:4 simple test aBoost.Logger.log('simple test'); // WARN|scox~ MyClass.myMethod:7 warning test aBoost.Logger.log(LoggingLevel.WARN, 'warning test'); } } For more information on logging with Apex BOOST, check out our blog post. |
---|
Description | Generate a log entry when the logging level is ERROR . This is useful when the only context required is the class, method, and line number (auto-generated) |
---|---|
Returns | a String including the context, level, and message |
Description | Generates a log entry at the specified logging level or less. This is useful when the only context required is the class, method, and line number (auto-generated) |
---|---|
Returns | a String including the context, level, and message |
Throws | InvalidParameterValueException if level is null |
Description | Generates a log entry when the logging level is ERROR . |
---|---|
Parameter | message: information (text, exception, etc.) to log |
Returns | a String including the context, level, and message |
Description | Generates a log entry at the specified logging level or less. |
---|---|
Parameter | message: information (text, exception, etc.) to log |
Returns | a String including the context, level, and message |
Throws | InvalidParameterValueException if level is null |
Description | An invocable logging method ("Log") for use with flows. |
---|---|
Parameter | events: one or more records; these should not be querried from the system, rather, they should be manually constructed in the flow and populated with flow or user values. |
Returns | a String for each event; each String includes the context, level, and message |
Throws | InvalidParameterValueException if events are null |
Description | A batch process that deletes old log records. On initial installation of Apex BOOST, this process is scheduled to run at 1am every day. The Log Days To Keep custom label specifies how many days log records will be kept. The default is DEFAULT_DAYS_TO_KEEP. Any exceptions thrown by Logger.Cleaner will be logged by Logger. Usage:// schedule the job to run every day at 1am System.schedule('Apex BOOST Log Cleaner', '0 0 1 * * ?', new aBoost.BatchJob(new aBoost.Logger.Cleaner())); // clean old logs immediately new aBoost.Logger.Cleaner().run(); |
---|