Log Viewer
The Logs page lists all log entries, including their level, message, contextual data and timestamps. Each entry is automatically linked to its parent execution, letting you trace the message back to the exact request, job, command, or scheduled task that generated it and explore all accompanying events.Log Context
Nightwatch automatically surfaces any contextual data attached to a log entry, giving you deeper insight into what was happening at the moment the message was written. Clicking a log entry opens the details drawer, where you can explore both the Log Context and Log Extra sections. For guidance on supplying context when writing logs, see Laravel’s documentation on contextual information.Public context added via the
Context facade is available in the Extra
section of the the details drawer.Configuring your logging setup
There are several ways to configure Nightwatch as part of your logging setup.Option 1: Adding Nightwatch to the Log Stack (Recommended)
If you’re using the defaultstack driver, you can simply add Nightwatch to the list of channels in your .env file:
Option 2: Exclusively send logs to Nightwatch
If you’d prefer to send logs exclusively to Nightwatch, you can set it as your main log channel in your.env file:
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:
Sampling
There are no direct sampling controls for logs, they are are automatically captured when their parent execution context is sampled.Filtering
Log Level Filtering
By default, Nightwatch respects Laravel’s default logging behavior, but you can customize which logs are sent to Nightwatch using theNIGHTWATCH_LOG_LEVEL environment variable.
NIGHTWATCH_LOG_LEVELenvironment variable- Laravel’s
LOG_LEVELenvironment variable - If neither variable is set, Nightwatch logs all messages of
debuglevel and higher sent to thenightwatchlog channel
Example
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
Log Levels
| 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 |