A fork of the Salesforce Labs unmanaged Package for organizing Batch Jobs and their Schedules via a record-based Scheduling Configuration, including dependencies and ad-hoc runs.
BatchJobLogger throws an error with the "logLegacy" method.
System.DmlException: Failed to save batch job log: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Batch_Job_Log__c, original object: User: []
The error comes from:
Class.BatchJobLogger.logLegacy: line 183, column 1
This actually happened while running one of our test-classes.
Is there anything we can do here?
we have several batch jobs scheduled which is working fine. But for logging, we are using Nebula Logger since the tool is more sophisticated for logging. Is it possible to combine both? The batch job logs can show whether the job was successfull, but Nebula allows us to log business logic related issues, but there we don't see whether the job was successful. It would be great to allow users to select the logging system.
Process could look like:
Batch Orchestrator starts with a job.
In the code of the job, we are using Logger.info to log stuff
Job was successful, so Orchestrator marks the log as successful (or at least, not as an error)
Both information (Status of job + business logic) is stored in one log
If business logic calls Logger.error(), the job/log should be marked as failed.
This requires more than one Scheduled Job to be able to do "normally". The other option would be to try and reschedule in the finish() section of a batch job to run after one of the jobs is done running.
This is to make it easier to incorporate the Batch Jobs in Flows that you might want to create on your own. Will also make it possible to start the PoC with sub-hourly schedules.