View real-time logs

更新时间:
复制 MD 格式

If an application encounters an issue, view the pod's real-time logs in the SAE console or the SLS console to diagnose the problem.

View real-time logs in SAE console

  1. In the SAE application list, select the target region and namespace at the top, and then click the target application ID to open the application details page.

  2. In the left-side navigation pane of the application details page, choose , and then select the desired instance from the Pod Name drop-down list.

    Note
    • SAE displays a maximum of 500 of the latest log entries. To view more logs, use the file logs feature. For more information, see View file logs.

    • If a pod encounters an issue, you can refer to common troubleshooting methods. For more information, see How do I resolve common pod issues?.

    • In the Real-time Log Refresh Frequency section, you can set the refresh interval. The available options are 5s, 10s, 15s, and Do Not Refresh.

    The Real-time Logs page displays information about the current pod, including its Pod Name, running status, IP address, and container ID. Below this section, the real-time logs are shown in a viewer, organized by line number.

View real-time logs in SLS console

In addition to viewing real-time logs in the SAE console, you can also redirect the output to collect logs in SLS. This section demonstrates how to view real-time logs from the stdout.log log source in the SLS console.

  1. In the SAE application list, select the target region and namespace at the top, and then click the target application ID to open the application details page.

  2. On the Basic Information page, click Deploy Application.

  3. On the Deploy Application page, expand the Startup Command Settings section and configure the startup command.

    For more information, see Configure a startup command.

    The Startup Command Settings section includes the system default startup command (CATALINA_OPTS="$CATALINA_OPTS $Options" catalina.sh run) and an options settings input box for customizing JVM parameters. To prevent Out-of-Memory (OOM) errors, ensure the heap size or initial JVM memory does not exceed the total instance memory and reserve about 1 GB of memory for the system.

  4. On the Deploy Application page, expand the Log Settings section, turn on the Activate Simple Log Service switch, and configure the SLS parameters.

    Choose Create Simple Log Service Resource or Use Existing Simple Log Service Resources based on your business needs. For detailed instructions, see Configure log collection to SLS.

    Important

    The Log Source must match the log source configured in Step 3.

  5. Click OK.

    Important

    After you click OK, SAE restarts the application. Perform this action during off-peak hours to minimize service disruption.

  6. After the application is deployed, view the real-time logs.

    1. Log in to the SLS console.

    2. In the Project list, select your project. On the Logstores tab, select the appropriate Logstore to view the real-time logs.

More information

After analyzing the real-time logs, you may need to perform additional operations on your application. For more information, see the following topics: