Logging
Nightwatch supports multiple logging methods.
Setup Options
Nightwatch can ingest Laravel logs in real time. Once configured, logs will appear in the Event Stream inside Nightwatch — fully searchable and correlated with other event types in real time.
There are several ways to configure Nightwatch as part of your logging setup.
Option 1: Add Nightwatch to the Log Stack (Recommended)
If you’re using the default stack
driver, you can simply add Nightwatch to the list of channels in your .env
file:
Option 2: Send Logs to Nightwatch Only
If you’d prefer to send logs exclusively to Nightwatch, you can set it as your main log channel in your .env
file:
This disables other logging destinations like local files unless you combine them using a stack.
Option 3: Create a Custom Stack
If you’re using a custom log channel (e.g. syslog, etc.) and want to use it in combination with Nightwatch, you can create a custom stack in your .env
file:
For more information on Logging channels and how to combine them, refer to Laravel’s logging documentation.
Once Nightwatch is set up and running, you may want to explore some advanced options to customize how data is collected from your Laravel application.
Log Level Configuration
The Nightwatch logger is configured to respect Laravel’s standard logging behavior. It follows these rules in priority order:
NIGHTWATCH_LOG_LEVEL
environment variable- Laravel’s
LOG_LEVEL
environment variable - If neither variable is set, Nightwatch logs all messages of
debug
level and higher sent to thenightwatch
log channel
Log Configuration Example
In the following example, Laravel’s single channel would log warning
level and higher, while Nightwatch would log error
level and higher.
Log Levels Reference
Log level | Description |
---|---|
debug | Detailed debug information |
info | Interesting events |
notice | Uncommon events |
warning | Exceptional occurrences that are not errors |
error | Runtime errors |
critical | Critical conditions |
alert | Action must be taken immediately |
emergency | Urgent alert |