User
Write something
DevOps Workshop is happening in 6 days
Custom Logger Issue
Hello everyone, I am having issues with my custom logger When I add logger to trigger handler and Queable not able to detect logs. My code for Trigger Handler public without sharing class ContactTriggerHandler { public void afterInsert(List<Contact> newContacts) { CustomLogger.log( CustomLogger.LogLevel.DEBUG, 'afterInsert handler invoked. Total incoming contacts: ' + newContacts.size(), null, null, 'ContactTriggerHandler' ); List<Contact> contactsWithEmail = new List<Contact>(); for (Contact c : newContacts) { if (String.isNotBlank(c.Email)) { contactsWithEmail.add(c); } } if (!contactsWithEmail.isEmpty()) { System.enqueueJob(new StripeCustomerQueueable(contactsWithEmail)); } } } ============== Queable Class public without sharing class StripeCustomerQueueable implements Queueable, Database.AllowsCallouts { private Set<Id> contactIds; public StripeCustomerQueueable(List<Contact> contacts) { this.contactIds = new Map<Id, Contact>(contacts).keySet(); CustomLogger.log( CustomLogger.LogLevel.DEBUG, 'Queueable created. Contact IDs = ' + this.contactIds.size(), null, null, 'StripeCustomerQueueable' ); } public void execute(QueueableContext context) { CustomLogger.log( CustomLogger.LogLevel.INFO, 'StripeCustomerQueueable execution started.', null, null, 'StripeCustomerQueueable' ); List<Contact> contactsFromDb = [ SELECT Id, FirstName, LastName, Email, Phone, Description FROM Contact WHERE Id IN :contactIds ]; CustomLogger.log( CustomLogger.LogLevel.DEBUG, 'Fetched ' + contactsFromDb.size() + ' contacts from DB.', null, null, 'StripeCustomerQueueable' ); List<Contact> contactsToUpdate = new List<Contact>(); StripeCallout stripeCallout = new StripeCallout(); for (Contact c : contactsFromDb) { try { String stripeCustomerId = stripeCallout.createCustomer(c); if (String.isNotBlank(stripeCustomerId)) { contactsToUpdate.add(new Contact( Id = c.Id, Stripe_Customer_Id__c = stripeCustomerId )); CustomLogger.log(
US Week #7
This week, we'll go a little deeper into something we discussed briefly last week - data signing. We can also use this time to review other concepts from previous sessions. Live in 27 minutes!
Week #4 - Logging & Testing
Welcome to week 4 :) We will finally cover how to use the logger and create a lightweight logging framework. Solve the homework and write your solution in the comments here 👇 Good luck ;)
Week #4 - Logging & Testing
1-30 of 39
Integration Mastery Cohort
skool.com/integration-mastery-cohort-4062
Learn Integrations in 8 weeks.
Leaderboard (30-day)
Powered by