Skip to content

Handlers, Log Viewer & Troubleshooting

Logging Handlers

Database Logging

The database handler stores log entries in your WordPress database. When activated, a Log Viewer menu item appears in the ASA2 admin menu.

SettingDescription
ActivateEnable database logging.
Retention (Days)How many days to keep log entries. Default: 30. Set to 0 to disable automatic cleanup.
Minimum LevelOnly log entries at this level or above are saved. Default: INFO.

BetterStack (Logtail)

Sends log entries to BetterStack's cloud-based log management platform.

License required

BetterStack integration requires a valid ASA2 Advanced Log license.

SettingDescription
ActivateEnable BetterStack logging.
Source TokenYour BetterStack source token. Found in BetterStack under Sources → your source → Source token.
Minimum LevelOnly log entries at this level or above are sent to BetterStack. Default: INFO. Recommended: WARNING or ERROR to avoid excessive data volume.

Sentry

Sends errors and exceptions to Sentry for error tracking.

License required

Sentry integration requires a valid ASA2 Advanced Log license.

SettingDescription
ActivateEnable Sentry error tracking.
DSNYour Sentry Data Source Name. Found in Sentry under Project Settings → Client Keys (DSN).
EnvironmentEnvironment label for filtering in Sentry (e.g., production, staging, development). Default: production.
Minimum LevelOnly log entries at this level or above are sent to Sentry. Default: INFO. Recommended: WARNING or ERROR.

Slack

Sends formatted notifications to a Slack channel via an Incoming Webhook.

License required

Slack integration requires a valid ASA2 Advanced Log license.

SettingDescription
ActivateEnable Slack notifications.
Webhook URLYour Slack Incoming Webhook URL. See Creating a Slack Webhook below.
ChannelTarget Slack channel (e.g., #asa2-logs). Optional — if not specified, the webhook's default channel is used.
UsernameBot name displayed in Slack. Default: ASA2 Log.
Minimum LevelOnly log entries at this level or above trigger a notification. Default: INFO. Recommended: WARNING or ERROR to avoid notification fatigue.

Log Levels

The plugin supports eight standard log levels, from least to most severe:

LevelDescription
DEBUGDetailed diagnostic information for development.
INFOInformational messages about normal operation.
NOTICENormal but noteworthy events.
WARNINGWarning conditions that may indicate a problem.
ERRORError conditions — something went wrong.
CRITICALCritical conditions requiring immediate attention.
ALERTAction must be taken immediately.
EMERGENCYSystem is unusable.

Each logging destination has its own minimum level setting. A destination only receives log entries at or above its configured level. This allows you to optimize costs and reduce noise — for example:

  • Database: Set to DEBUG or INFO for comprehensive local logs.
  • BetterStack: Set to WARNING to capture only potential issues.
  • Sentry: Set to ERROR to focus on actual errors.
  • Slack: Set to CRITICAL for urgent notifications only.

Log Viewer

When database logging is activated, the Log Viewer provides a web-based interface to browse and search your log entries.

Accessing the Log Viewer

Go to ASA2 → Log Viewer in your WordPress admin.

Features

  • Sortable table with columns: Time, Level (color-coded), Channel, Message
  • Full-text search across log messages and context data
  • Filter by level — Show only entries of specific levels (e.g., only errors)
  • Filter by channel — Show only entries from specific logging channels
  • Expandable details — Click a log entry to see its full context and extra data
  • Pagination with adjustable entries per page (1–200)
  • Search highlighting — Search terms are highlighted in results

Controls

ControlDescription
Auto-RefreshWhen enabled, the log viewer automatically refreshes every 30 seconds. Your preference is saved in your browser.
RefreshManually refresh the log entries.
Dark ModeToggle a dark theme for the log viewer. Your preference is saved in your browser.
Menu ToggleCollapse the ASA2 sidebar to give the log viewer more screen space. Your preference is saved in your browser.
Clear All LogsDelete all log entries from the database. A confirmation dialog appears before deletion.

Setting Up External Services

Creating a BetterStack Source

  1. Sign up or log in at betterstack.com.
  2. Go to Logs → Sources → Connect source.
  3. Choose a platform (e.g., HTTP / JSON).
  4. Copy the Source Token and paste it into the plugin settings.

Creating a Sentry Project

  1. Sign up or log in at sentry.io.
  2. Create a new project (choose PHP as the platform).
  3. Go to Project Settings → Client Keys (DSN).
  4. Copy the DSN and paste it into the plugin settings.

Creating a Slack Webhook

  1. Go to api.slack.com/apps and click Create New App → From scratch.
  2. Name the app (e.g., "ASA2 Logs") and select your workspace.
  3. Under Features, click Incoming Webhooks and toggle it on.
  4. Click Add New Webhook to Workspace and select the channel where notifications should be posted.
  5. Copy the Webhook URL and paste it into the plugin settings.

Basic Setup (Database Only)

For most users, database logging is sufficient:

  1. Enable the plugin under General settings.
  2. Activate Database Logging with the default settings.
  3. Use the Log Viewer to monitor your ASA2 activity.

Production Setup (Multiple Destinations)

For production sites where reliability matters:

  1. Database: Level INFO, retention 30 days — comprehensive local logs.
  2. Slack: Level ERROR — immediate notifications when something breaks.
  3. Sentry (optional): Level WARNING — track and group recurring issues.

High-Volume Site

For sites with heavy traffic where log volume is a concern:

  1. Database: Level WARNING, retention 7 days — keep only potential issues locally.
  2. BetterStack: Level WARNING — centralized cloud storage with search and alerting.
  3. Slack: Level CRITICAL — only the most urgent issues trigger notifications.

Troubleshooting

No log entries appear in the Log Viewer

  1. Check the master toggle: Make sure the plugin is activated in General → Activate Plugin.
  2. Check database logging: Make sure Database Logging → Activate is enabled.
  3. Check the minimum level: If set to ERROR, only error-level messages and above are recorded. Try setting it to DEBUG temporarily to see all messages.
  4. Trigger a log entry: Perform an action in ASA2 that generates a log message (e.g., refreshing product data).

BetterStack is not receiving logs

  1. Verify the source token: Make sure the token matches exactly what BetterStack shows in your source settings.
  2. Check the minimum level: If set to ERROR but ASA2 is only logging INFO messages, no entries will be sent.
  3. Check your server's outgoing connections: Some hosting providers block outgoing HTTPS requests. Contact your host if you suspect this.

Slack notifications are not arriving

  1. Verify the webhook URL: Make sure the full URL is pasted, starting with https://hooks.slack.com/.
  2. Check the channel: If you specified a channel, make sure the Slack app has been invited to that channel.
  3. Check the minimum level: Set to WARNING or lower temporarily to test.
  4. Test the webhook: You can test the webhook directly by visiting your Slack app's webhook settings page.

Sentry is not receiving events

  1. Verify the DSN: Make sure the full DSN URL is pasted correctly.
  2. Check the environment: Verify the environment name matches what you use in Sentry's filters.
  3. Check the minimum level: Sentry typically works best at WARNING or ERROR level.

Database is growing too large

  1. Reduce retention: Lower the retention days in Database Logging → Retention (Days).
  2. Increase minimum level: Set to WARNING or ERROR to reduce the number of stored entries.
  3. Clear logs: Use the Clear All Logs button in the Log Viewer for an immediate cleanup.

ASA2 - The Amazon Affiliate Plugin for WordPress