If an exception occurs in an application, you can view the real-time logs of a pod in the SAE or Log Service console to identify the issue.

View real-time logs in the SAE console

  1. Log on to the SAE console.
  2. In the left-side navigation pane, click Applications. In the top navigation bar, select a region and click the name of an application.
  3. In the left-side navigation pane, choose Log Management > Real-time Logs. On the Real-time Logs page, select an instance name from the Pod Name drop-down list.
    Note
    • SAE can display up to 500 most recent logs. If you want to view more logs, use the file log collection feature. For information, see View file logs.
    • You can select a refresh frequency for real-time logs from the Real-time Log Refresh Frequency drop-down list. Valid values: 5s, 10s, 15s, and Do Not Refresh.
    pg_view_log

View real-time logs in the Log Service console

You can log on to the SAE console to view real-time logs. You can also collect logs to Log Service by using the output redirection method. This section provides an example on how to collect real-time logs to the stdout.log log source and describes how to view the real-time logs in the Log Service console.

  1. Log on to the SAE console.
  2. In the left-side navigation pane, click Applications. In the top navigation bar, select a region and click the name of an application.
  3. In the upper-right corner of the Basic Information page, click Deploy Application.
  4. On the Deploy Application page, expand the Startup Command Settings section to configure a startup command.
    For more information, see Configure startup commands. Specify a startup command for log collection
  5. On the Deploy Application page, expand the Log Collection Service section, turn on Enable Log Collection to Log Service, and configure the parameters.
    Select Create Log Service Resource or Use Existing Log Service Resources based on your business requirements. For more information, see Configure log collection to Log Service.
    Important Specify the log source that you specified in Step 4 in the Log Source field.
  6. Click Confirm.
    Important After you click Confirm, SAE restarts the application. We recommend that you configure the settings during off-peak hours.
  7. After the application is deployed, view real-time logs.
    1. Log on to the Log Service console.
    2. In the Projects section, select the project to which real-time logs are collected. On the Logstores tab, select the Logstore to view real-time logs.

References

After you view real-time logs, you can perform related operations on specific logs based on your business requirement. For more information, see the following topics: