How to access drupal application logs for an environment
This documentation focuses on Drupal application logs, but the same concept could be implemented in PHP applications with the syslog functionality.
Drupal's default installation profile come with (Database Logging)
dblog enabled, which facilitates you to see the logs on the website
itself. However for (high traffic) live sites it is not a good idea to
keep it enabled.
Luckily there are alternatives:
one of them is built in in Drupal: the
syslog module, and Dropsolid
experience cloud has support for it after some configuration.
For more information about the syslog module see the documentation
- Determine the unique identifier that will be used. The format is
dropsolid-platform_<project machine name>_<environment machine name>Examples:
- Enable the
syslogmodule through the UI or CLI.
- Go to
/admin/config/development/loggingand configure syslog:
- Syslog Identity: the previously determined unique identifier
- Syslog facility: select
Syslog format: the default value is ok, but it doesn't contain the
severityof a message. See the caveats.
Screenshot of a filled in form as example: - Ensure these configuration changes are persistent (for D8 and D9: via config export)
The monolog module goes even further than syslog, and allows a more granular configuration for what messages/alerts to log to which location (dblog, syslog, ...)
If you configure monolog to use syslog with the same unique identifier as in the syslog explanation above, you can also download those logs via Dropsolid Platform.
Caveats and good-to-knows¶
Severity of a log message¶
Syslog has concepts and logic based on the severity (error, warning, info, debug, ...) of a message. This logic can e.g. store the log messages in separate files based on that severity.
The application logs on Dropsolid Experience Cloud Platform don't use separate files. There is 1 logfile per environment that contains all log messages, regardless of the syslog severity.
If you want to store the severity in the log message, you have to alter the syslog format.
For Drupal 7 sites, severity is not exposed as token for the log message. See the core issue and the patch if you want to add the severity.
How to download the logs¶
- On Dropsolid Platform select your project & environment where you want to see logs from.
On the right hand side under 'Shortcuts' press the 'Logs' button
The platform will fetch the logs