Nebula Logger Salesforce - Complete Installation Guide
Learn how to install and configure Nebula Logger in Salesforce to replace debug logs with persistent, searchable logging and real-time notifications.
Salesforce debug logs are not helpful when you need to debug a production error. With a capped size of 20MB per log, and a 24-hour expiration date, you're bound to miss important information.
That's where Nebula Logger comes in. This free, open-source logging framework gives you persistent logs, real-time notifications, and powerful debugging tools that standard debug logs can't match. In this guide, you'll learn how to install Nebula Logger in Salesforce, configure it for Apex and Lightning Web Components, and set up instant Slack notifications.
Let's get you set up with professional-grade logging in minutes.
What Is Nebula Logger in Salesforce?
Nebula Logger is a free, open-source logging framework built specifically for Salesforce. Created by Jonathan Gillespie, it replaces System.debug() statements with a robust logging system that stores data permanently and ties related information together.
Unlike standard debug logs, Nebula Logger lets you:
- Store logs indefinitely (no 24-hour expiration)
- Categorize logs by severity level (error, warn, info, debug)
- Link related logs together in async transactions
- Attach record data, callout details, and exceptions to logs
- Receive instant notifications via Slack
- View logs in pre-built dashboards
The key difference: Standard debug logs are temporary debugging tools. Nebula Logger is a production-ready monitoring system.
How to Install Nebula Logger in Salesforce
Installing Nebula Logger takes less than five minutes. You'll use the package installation links from the official GitHub repository.
- Visit the Nebula Logger GitHub page
- Click the installation link for your environment (Production or Sandbox)
- Review and accept the installation settings
- Assign permission sets to users who need logging access
Getting Started with Nebula Logger in Apex
Instead of temporary debug statements, you'll use persistent log entries that save automatically.
Take a standard debug log:
System.debug('Test');And replace with the logger class:
Logger.debug('Test');
Logger.saveLog();Always call Logger.saveLog() at the end of your transaction. This persists your logs to the database. Without it, your log entries won't save.
Additionally, Nebula Logger supports multiple log levels, just like standard debug logs:
Logger.error('ERROR');
Logger.warn('WARN');
Logger.info('INFO');
Logger.debug('DEBUG');Tying Data to Logs
Simple log messages tell you what happened. Logs with attached data tell you why it happened.
Nebula Logger lets you attach database records, callout details, and exceptions to your log entries. This transforms generic error messages into comprehensive debugging information.
Example: Logging Database Errors
Imagine you're inserting a Lead record that fails validation for not having a name:
public static void insertLead() {
Lead l = new Lead();
l.Status = 'New';
l.Description = 'Additional data';
// All or nothing = false
Database.SaveResult sr = Database.insert(l, false);
if (!sr.isSuccess()) {
Logger.error('Insert Lead Error').setRecord(l).setDatabaseResult(sr);
}
Logger.saveLog();
}This single log entry captures the record data, the validation error message, and a link to the record in Salesforce. You get everything you need to fix the issue without digging through multiple debug logs.
The chaining syntax lets you attach multiple pieces of data:
Logger.error('Operation failed')
.setRecord(myRecord)
.setDatabaseResult(result)
.addException(e);You can combine record data, database results, callout details, and exceptions in one log entry.
Logging Callouts with Nebula Logger
Callouts are one of the most common failure points in Salesforce integrations. When an external API call fails, you need to know what you sent, what you received, and what data triggered the call.
Nebula Logger makes callout debugging simple:
public static void getWeather(){
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:/Weather');
req.setMethod('GET');
HttpResponse res = h.send(req);
Logger.info(req.getEndpoint())
.setHttpResponseDetails(res)
.setHttpRequestDetails(req);
Logger.saveLog();
}This log entry captures the endpoint URL, request headers and body, response status and body, and timing information. All in one place, permanently stored.
If you're building integrations with external systems, this logging approach is essential. When debugging integrations like QuickBooks connections or other third-party APIs, having complete callout logs saves hours of troubleshooting.
Linking Related Logs in Async Apex
Batch classes and queueable jobs create hundreds of log entries per run. Without grouping, you can't tell which logs belong to the same transaction.
Nebula Logger solves this with parent transaction IDs:
public class ExampleQueueable implements Queueable {
private String originalTransactionId;
public void execute(QueueableContext context) {
if (String.isBlank(this.originalTransactionId)) {
this.originalTransactionId = Logger.getTransactionId();
} else {
Logger.setParentLogTransactionId(this.originalTransactionId);
}
// Your processing logic here
Logger.saveLog();
}
}All logs in this queueable chain link back to the original transaction. You can trace errors across async boundaries and see the complete execution flow.
This is especially useful for complex batch processes that span multiple async transactions.
Using Nebula Logger in LWC
Front-end errors need logging too. Nebula Logger includes a Lightning Web Component that lets you log client-side events directly to Salesforce.
Basic LWC logging example:
import { LightningElement } from "lwc";
import { getLogger } from "c/logger";
export default class loggingExample extends LightningElement {
logger = getLogger();
handleButtonClick(){
this.logger.info("Button Click");
this.logger.saveLog();
}
}This creates a log entry in Salesforce whenever the button clicks, complete with user context and timestamp.
For exception handling:
failAsync() {
return Promise.reject(new Error("Intentional async failure"));
}
handleExceptionButtonClick() {
this.failAsync()
.then(() => {
this.logger.info("Button Click");
this.logger.saveLog();
})
.catch((err) => {
this.logger.error("Button Click Error").addException(err);
this.logger.saveLog();
});
}Now you can track front-end errors alongside backend logs, giving you complete visibility across your Salesforce application.
Understanding the Nebula Logger Dashboard
Once you have logs flowing, Nebula Logger provides pre-built dashboards that show:
- Log volume by severity level
- Errors by Apex class
- Errors by user
- Log trends over time
These dashboards help you identify patterns before they become critical issues. If one Apex class generates most of your errors, you'll see it immediately.
The dashboards update in real-time as new logs are created. You can filter by date range, log level, and user to drill into specific issues.
Setting Up Slack Notifications
Dashboards are great for reviewing errors, but they don't alert you when problems happen. Nebula Logger's Slack plugin sends instant notifications whenever errors occur.
- Install the Nebula Logger Slack Plugin from GitHub
- Create a Slack app at https://api.slack.com/apps?new_app=1
- Enable Incoming Webhooks in your Slack app
- Copy the webhook URL (keep this secret—it contains authentication keys)
- In Salesforce, go to Custom Metadata → Logger Parameters → Slack Endpoint
- Paste the webhook URL and set the minimum log level (typically ERROR or WARN) Once configured, you'll receive Slack messages for every log entry at or above your threshold level.
Next Steps
You now have Nebula Logger installed and configured. Your logs persist beyond 24 hours, include rich context data, and alert you in real-time when problems occur.
For more Salesforce integration tutorials, see our guide on using Named Credentials in Salesforce, which pairs perfectly with Nebula Logger's callout logging features.