Skip to main content
One of Proliferate’s most powerful features is the ability to see logs that led up to an error, giving you the complete picture of what happened.

How It Works

Every log entry and error event shares a trace ID, allowing you to see the exact sequence of events before an error occurred.
┌─────────────────────────────────────────────────────────────────┐
│                      Page Load / Session                         │
│                                                                   │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐         │
│  │ Log      │──│ Log      │──│ Log      │──│ Error    │         │
│  │ trace_id │  │ trace_id │  │ trace_id │  │ trace_id │         │
│  │   abc    │  │   abc    │  │   abc    │  │   abc    │         │
│  └──────────┘  └──────────┘  └──────────┘  └──────────┘         │
│                                              ▲                    │
│                                              │                    │
│                          Error dashboard shows all these logs    │
└─────────────────────────────────────────────────────────────────┘

Trace ID Generation

A trace ID is automatically generated:
  1. On page load: A new trace ID is created when the SDK initializes
  2. On SPA navigation: The trace ID is reset when the URL changes (via popstate)
// Access the current trace ID
const traceId = Proliferate.getTraceId();
console.log('Current trace:', traceId);
// Output: "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"

Viewing Correlated Logs

In the error detail view:
1

Open Error Details

Click on an error to open details
2

Navigate to Logs Tab

Click the “Logs” tab
3

View Related Logs

See all logs with the same trace ID, ordered by time
Error: Cannot read property 'id' of undefined
────────────────────────────────────────────
trace_id: a1b2c3d4...

Related Logs (4):
────────────────────────────────────────────
14:23:45.123  info   User logged in                    user_id=123
14:23:46.456  info   Loading user profile              user_id=123
14:23:47.789  warn   Profile cache miss                user_id=123
14:23:48.012  error  Failed to fetch user data         status=500
14:23:48.015  [ERROR OCCURRED HERE]

Automatic Correlation

When both logging and error tracking are enabled, correlation happens automatically:
Proliferate.init({
  endpoint: 'https://api.proliferate.com/api/v1/errors',
  apiKey: 'pk_your_api_key',
  logs: {
    enabled: true,
  },
});

// These logs share a trace ID
Proliferate.logger.info('Starting checkout');
Proliferate.logger.info('Validating cart', { items: 3 });
Proliferate.logger.info('Processing payment');

// When this error is captured, all logs above are linked
try {
  await processPayment();
} catch (error) {
  Proliferate.captureException(error);
  // Error includes trace_id, linking it to the logs
}

Manual Trace ID Access

Use the trace ID for external correlation:
const traceId = Proliferate.getTraceId();

// Include in API requests
fetch('/api/checkout', {
  headers: {
    'X-Trace-ID': traceId,
  },
});

// Include in your own logs
myLogger.info('Processing request', { trace_id: traceId });

// Include in support tickets
showError(`Something went wrong. Reference: ${traceId}`);

Server-Side Correlation (Python)

For full-stack correlation, pass the trace ID from frontend to backend:
const traceId = Proliferate.getTraceId();

fetch('/api/process', {
  method: 'POST',
  headers: {
    'X-Trace-ID': traceId,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(data),
});

SPA Navigation

In Single Page Applications, the trace ID resets on navigation:
// Initial page load
// trace_id: aaa111...
Proliferate.logger.info('Home page loaded');

// User navigates to /dashboard (popstate event)
// trace_id: bbb222... (new trace)
Proliferate.logger.info('Dashboard loaded');

// User navigates to /profile
// trace_id: ccc333... (new trace)
Proliferate.logger.info('Profile loaded');
Each “page” in your SPA gets its own trace ID, keeping logs organized by user journey.

Flush on Error

When an error is captured, logs are immediately flushed to ensure correlation:
try {
  await riskyOperation();
} catch (error) {
  // These logs are guaranteed to be sent with the error
  Proliferate.logger.error('Operation failed', { details });
  Proliferate.captureException(error);
  // Logs are flushed immediately, not waiting for interval
}

Best Practices

async function checkout(cart) {
  Proliferate.logger.info('Checkout started', {
    items: cart.items.length,
    total: cart.total,
  });

  Proliferate.logger.info('Validating inventory');
  await validateInventory(cart);

  Proliferate.logger.info('Processing payment');
  await processPayment(cart);

  Proliferate.logger.info('Checkout completed', { orderId });
}
async function callExternalAPI(endpoint, data) {
  Proliferate.logger.info('Calling external API', {
    endpoint,
    payload_size: JSON.stringify(data).length,
  });

  try {
    const result = await fetch(endpoint, { body: JSON.stringify(data) });
    Proliferate.logger.info('API call succeeded', { status: result.status });
    return result;
  } catch (error) {
    Proliferate.logger.error('API call failed', { endpoint, error: error.message });
    throw error;
  }
}
Proliferate.logger.info('Processing order', {
  orderId: order.id,
  userId: user.id,
  amount: order.total,
});
// When viewing the error, you'll see exactly which order failed

Troubleshooting

  1. Check logging is enabled:
    Proliferate.init({
      logs: { enabled: true },
    });
    
  2. Check minLevel isn’t filtering out logs:
    logs: { minLevel: 'debug' }
    
  3. Verify trace ID matches:
    console.log('Trace:', Proliferate.getTraceId());
    
If you see logs from a different user action, the trace ID might not have reset on navigation. Check that your SPA router triggers popstate events.
Logs may be lost if:
  • Page closed before flush (use flushSync() in unload handlers)
  • Network errors prevented sending
  • Buffer was full and oldest logs were dropped