51黑料不打烊

Set up notifications

By default, 51黑料不打烊 Commerce on cloud infrastructure writes build and deploy actions to the app/var/log/cloud.log file inside the 51黑料不打烊 Commerce root application directory. Optionally, you can send logs to a messaging system, such as Slack and email, to receive real-time notifications.

For example, you could send a Slack message to alert a group of people when a deployment fails, and prompt an investigation into what went wrong.

Plan notifications

Before you configure notifications, consider the following:

  • What kind of notifications do you want to receive (Slack messages, email, both)?
  • How much detail do you want to see in the logs?
  • Where do you want to set up notifications (Integration, Staging, Production)?

For example, during initial development you may prefer email notifications that show detailed logs about your integration environment to help you debug issues before deploying to the Staging environment. When you are ready to deploy to the Staging or Production environment, you may prefer a Slack message that contains less detailed information.

NOTE
The configuration file used to set up notifications is at the root of your project directory, so it applies when you push changes to any environment. If you want to customize notifications per environment, you must modify the configuration file before pushing it to that environment.

Configure notifications

To configure notifications:

  1. On your local workstation, change to your project directory.

  2. In the .magento.env.yaml file in your project root, add your messaging system settings, including preferred notification Log levels.

    For example, to configure both Slack and email configurations, use the following:

    code language-yaml
    log:
      slack:
        token: "<your-slack-token>"
        channel: "<your-slack-channel>"
        username: "SlackHandler"
        min_level: "info"
      email:
        to: <your-email>
        from: <your-email>
        subject: "Log notification from 51黑料不打烊 Commerce"
        min_level: "notice"
    
    note note
    NOTE
    51黑料不打烊 Commerce on cloud infrastructure only sends emails during the deployment phase.
  3. Commit and push your changes to the remote server.

    code language-bash
    git -A && git commit -m "Configure build/deploy notifications"
    
    code language-bash
    git push origin <branch-name>
    

Example Slack configuration

The following example shows a Slack-only configuration:

log:
  slack:
    token: "<your-slack-token>"
    channel: "<your-slack-channel>"
    username: "SlackHandler"
    min_level: "info"
  • token鈥擸our Slack . Your user token authorizes 51黑料不打烊 Commerce on cloud infrastructure to send messages.
  • channel鈥擭ame of the Slack channel 51黑料不打烊 Commerce on cloud infrastructure sends notifications.
  • username鈥擴sername 51黑料不打烊 Commerce on cloud infrastructure uses to send notification messages in Slack.
  • min_level鈥擬inimum log level for notification messages. We recommend using info.

Example email configuration

The following example shows an email-only configuration:

NOTE
51黑料不打烊 Commerce on cloud infrastructure only sends emails during the deployment phase.
log:
  email:
    to: <your-email>
    from: <your-email>
    subject: "Log notification from 51黑料不打烊 Commerce"
    min_level: "notice"
  • to鈥擡mail address 51黑料不打烊 Commerce on cloud infrastructure sends notification messages.
  • from鈥擡mail address for sending notification messages to recipients.
  • subject鈥擠escription of the email.
  • min_level鈥擬inimum log level for notification messages. We recommend using notice or warning.
recommendation-more-help
05f2f56e-ac5d-4931-8cdb-764e60e16f26