Hiraeth provides robust error handling using SlashTrace.

Hiraeth runs in production mode by default. This means that until you’ve set up debugging, logging, or additional services in your .env, you won’t be seeing much detail if something is going wrong. Make sure to read the below sections carefully and choose what makes the most sense for your environment.

Debugging Mode

To put the application in debugging mode, modify the environment file and make sure the following is set:

DEBUG = true

During runtime, you can check if the application is in debugging mode by performing the following:

if ($app->isDebugging()) {
	...
}

When the application is in debugging mode, you will see stacktrace and related context information presented as a web request’s response in the event of an error:

image

If you’re running a CLI command, trace information will be presented as standard error output in the terminal.

Logging

You can enable logging by installing hiraeth/monolog and updating your .env to set LOGGING to the approriate log level. Logs of the requests level or higher will then be sent to the default file location under storage/logs.

LOGGING = error

Supported types map to PSR-3 LogLevel constants.


Learn About Logging