SLS Plug-In in Alibaba Cloud Toolkit Helps Troubleshoot Online Services
By Taiye , from Alibaba Cloud Storage Team
Product Introduction
Alibaba Cloud Toolkit is an IDE-targeted plug-in for developers that helps them efficiently develop and deploy applications for cloud environments. After completing the development, debugging, and testing of your application locally, you can install Alibaba Cloud Toolkit in the IDE, such as Eclipse or IntelliJ. You can connect to a cloud environment and deploy your application to the cloud through graphical configuration.
Pain Points Resolved by SLS Plug-In
Online troubleshooting is an essential experience for a software developer. In services of different maturity levels, the processes of online troubleshooting vary slightly. For software developed by some small start-up companies, its service may still be single-point, or a cluster is built by several machines. Therefore, we need to go to each server and check the logs of each service through SSH. Companies with higher maturity will build their own log service platform or use a mature log platform like SLS to organize and manage online logs. This saves the trouble of checking logs on the server through SSH and significantly improves troubleshooting efficiency.
However, it is still not perfect. Here is a common scenario. When an exception occurs online, we will find the service log on the page of the log service platform, such as the Java Stack Trace. The Java Stack Trace is usually long. So, we need to switch back and forth between the page and IDE of the log service platform to accurately find the exception from the codebase. In some cases, when the log takes too long, we also need to copy the log to the local file. Switching back and forth between different windows wastes a lot of precious time.
Alibaba Cloud Toolkit integrates the functions of the SLS log platform to conveniently and accurately associate the logs of the Log Service platform with the code, helping software developers easily query the desired logs in IDE. Log Service is a cloud-native monitoring and analysis platform. It provides large-scale, low-cost, and real-time services to process multiple types of data, such as Log, Metric, and Trace. Log Service allows you to collect, transform, query, analyze, visualize, ship, and consume data. You can also configure alerts in the console. It also helps enterprises improve their digital capabilities in terms of R&D, O&M, and data security.
Let's look at a common Java service exception troubleshooting scenario and see how convenient SLS is in the Alibaba Cloud Toolkit plug-in.
Scenario Simulation
Service Simulation
First, we can simulate a service with an online exception. Create a simple springboot service and implement a Component bean of ApplicationRunner. This is very simple. It prints a line of NPE logs every second to simulate the service of NPE online.
@Component
@Slf4j
public class LogDemoService implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
while (true) {
try {
String field = null;
System.out.println(field.length());
Thread.sleep(1000);
} catch (Exception e) {
log.error("write exception log :", e);
}
}
}
}
After the service is packaged, start the service on the server.
SLS Collection, Deployment, and Verification
Then, we can deploy the log collection service of SLS on the server. Please see this link for specific operation files.
This step will collect logs to the logstore of SLS:

After we confirm the logs have been successfully collected on the SLS page, the service simulation and the access to the log platform have been completed. Let's return to IDE.
IDE Configuration and Instructions
First, we can find the Alibaba Cloud Toolkit through the marketplace of plug-ins of IntelliJ. Click install and then restart IDE for it to take effect:

Click Tools → Alibaba Cloud → Preference to configure the account information. You need to enter the Access Key Id and Access Key Secret of the account that has permission to view SLS logs.


Click Tools → Alibaba Cloud → Alibaba Cloud View → Alibaba Cloud SLS

Now, you can see the log query interface of SLS at the bottom of the IDE window.

After selecting the corresponding region and project, click the view button on the right side of the corresponding logstore.

Just like the SLS page, you can view the logs of the services in IDE. This interface also supports the filtering of log time ranges and the filtering of query and analysis statements, which can help developers quickly and accurately find the desired log data. Please refer to this link for SLS query and analysis statements.
It is impossible to see the complete information at one time in this interface with long logs like the Java Stack Trace. There is an "Open in Editor" button on the right side of each log in the query results.

Click it, and you can view this log on the new page of IDE, which is convenient for developers to obtain the complete information.

Summary
Alibaba Cloud Toolkit is an excellent plug-in. It adds the function of the Log Service and integrates the functions of the Log Service platform into IDE for common problem troubleshooting scenarios in software developers' daily work. This saves the time of switching back and forth between windows and improves the daily work efficiency.
Read previous post:
Use Command Line on the Terminal to Implement Visualized Analysis of Logs
Read next post:
How Is Alibaba Cloud Empowering the Startup Ecosystem in Malaysia?
-
-
Alibaba Cloud Community
1,605 posts | 526 followers
Follow
Comments
-
-
Alibaba Cloud Community
1,605 posts | 526 followers
Follow
Related Products
-
Simple Log Service
An all-in-one service for log-type data
Learn More -
Qoder
From Assisted to Autonomous — Adapting to Every Programming Need
Learn More -
Storage Capacity Unit
Plan and optimize your storage budget with flexible storage services
Learn More -
Log Management for AIOps Solution
Log into an artificial intelligence for IT operations (AIOps) environment with an intelligent, all-in-one, and out-of-the-box log management solution
Learn More
More Posts by Alibaba Cloud Community
- The Easiest Way to Try the Latest Models in One Place: Token Plan Starting at $3 for the First Month
- 一個平台輕鬆試用最新 AI 模型:Token Plan 首月低至 $3
- Alibaba Cloud Advances AI Adoption in Malaysia with Nationwide Youth Contest and Industry Collaborations
- Alibaba Cloud Unveils New AI Initiatives at Hong Kong Summit to Advance the City’s AI Ecosystem
- QoderWake: Digital Workers Take the Initiative — No Need to @ Every Time
- What Is Model Thinking Effort? Should You Choose Low, High, or Maximum?
- High-Risk PHP and Node.js Vulnerabilities: A Scan Costs Pennies. A Miss Could Cost a Fortune.
- Alibaba Unveils Qwen4-Max: New AI Teammate for Work, Creativity, and Discovery
- Alibaba Brings Cloud and AI to the First Youth Olympic Games in Africa
- Introducing Qoder Lite: Start creating with Qoder for $10 a month