dschibster / sfdx-batch-orchestrator

A Package for organizing Batch Jobs and their Schedules via a record-based Scheduling Configuration, including dependencies and ad-hoc runs.
https://dschibster.github.io/sfdx-batch-orchestrator/
Other
10 stars 2 forks source link

Log into Nebula Logger #18

Open fentes opened 1 year ago

fentes commented 1 year ago

Hey Dennis,

awesome tool from an awesome guy 😉

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:

  1. Batch Orchestrator starts with a job.
  2. In the code of the job, we are using Logger.info to log stuff
  3. Job was successful, so Orchestrator marks the log as successful (or at least, not as an error)
  4. 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.

dschibster commented 1 year ago

Hey there Steffen and thanks for the suggestion. I really love Nebula Logger myself and would love to get it working with the Orchestrator, but first I'll need to come up with a few different concepts:

I'll give this a thought or two and come back to you! Also I'll probably ask if we can dig into the LogEntryBuilder or the Top-Level Metadata somehow to add association with Custom Fields. :)

Thanks for the positive feedback. Appreciate it when the tool provides value. :)

dschibster commented 1 year ago

Generally though @fentes I would still stipulate the use of the same methods as currently, but having logs be created by nebulaLogger in the background. This ensures that you don't actually have to refactor everything should you decide to switch Logging solutions in the middle of usage.

fentes commented 1 year ago

Hey general, my main concern is, we need to proactively look into the batch jobs to see whether something was crashing. For Nebula we need to do it as well, but I like to have one single place. Jongpie is already thinking about adding the possibility to send emails for error logs. Having both systems combined could make use of that as well. Replacing the Batch Job Logs completely might not be a must have. But if it would be possible to get rid of them, we could make use of the LogPurger + RetentionRules, to clean up the system.

dschibster commented 1 year ago

Purging is something I would like to create for Batch Job Logs specifically too. :) But for the time being I agree with you that having one unified Logging Solution would be awesome. I would say creating double Logs is not really clean, nor is it needed. The idea I have is to be able to see Logs that reflect what BJLs currently do, in the same place as Batch Job Logs currently reside. I don't want Nebula Logger integration to be a compromise but rather a combination of the best of these two worlds.

dschibster commented 1 year ago

@fentes For those people that don't feel like putting everything into Nebula Logger I'll create an issue for notifying about Jobs with failed Batches.