drush-ops / drush

Drush is a command-line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those who spend their working hours hacking away at the command prompt.
https://www.drush.org
2.34k stars 1.08k forks source link

Maintenance mode should be logged #5365

Open obriat opened 1 year ago

obriat commented 1 year ago

Maintenance mode is a major operation so it should be logged properly. The issue already exist on Drupal: https://www.drupal.org/project/drupal/issues/229778

Either log all state:set operation or only the major ones: system.*

weitzman commented 1 year ago

This could now be comfortable added to maint:set

obriat commented 2 months ago

My guess would be to add the following line at drush/src/Commands/core/MaintCommands.php:56

\Drupal::logger("system")->notice(dt('Maintenance Mode @state.', ['@state' => ($value === '1') ? 'enabled' : 'enabled']));

But IMHO the default drush behavior should be to forward all log messages to Drupal if a working instance is detected, so $this->logger()->info() could be used instead (https://github.com/drush-ops/drush/issues/5850#issuecomment-1956184153)

See also https://www.drupal.org/project/drupal/issues/229778#comment-14882222

weitzman commented 2 months ago

I think status who is fine. I encourage folks to keep working on an api to drupal core and that can do the logging. Once available drush will call that instead of state.

Until then feel free to hook into maint:set and add a log call.