View real-time logs

更新时间:
复制 MD 格式

When an application fails to deploy to a server, you can troubleshoot the issue by checking the server logs. Cloud Toolkit provides a built-in Terminal that lets you quickly view real-time log information when you deploy a local application to a server. This topic describes how to view real-time logs by deploying an application to a Linux server in IntelliJ IDEA.

Prerequisites

  • You have added a server in IntelliJ IDEA. For more information, see Add a remote server.
  • To upload files to a Windows system, ensure that OpenSSH is configured. For more information, see Preparations.

Procedure

  1. Open your project in IntelliJ IDEA.
  2. In the top menu bar of IntelliJ IDEA, choose Tools > Alibaba Cloud > Deploy to Host....
  3. In the Deploy to Host dialog box, on the Deployment tab, configure the application deployment settings.
    The following table describes the parameters.
    Parameter Description
    File Select Maven Build, Upload File, or Gradle Build.
    • Maven Build: If your project uses Maven, build and deploy it directly.
    • Upload File: If your project does not use Maven, or if a packaged deployment file exists on your local machine, select and upload the local deployment file.
    • Gradle Build: If your project uses Gradle, select this option to build and deploy.
    Target Host Click 加号 on the right. In the drop-down list, select a tag. Then, select the server where you want to deploy the application.
    Target Directory Enter the deployment path on the server, such as /root/tomcat/webapps.
    Command Enter the application start command, such as sh /root/restart.sh.
  4. In the Deploy to Host dialog box, click the Advanced tab and configure the following:
    1. In the Command area, enter the command to view real-time logs. For example:
      Important On Windows systems, the Command field supports all PowerShell commands by default.
    2. Select the Automatic open after deploy checkbox.
  5. Click Run.

Result Verification

After the deployment starts, the built-in Terminal logs in to the server and displays the application's real-time log information.

Demonstration