How Xianyu Automates Exception Log Tracking to Pinpoint Bugs Instantly
The Xianyu team built an automated exception‑log tracking system that scans pre‑release logs, extracts stack information with regex, maps errors to Git file paths and commit authors, and automatically assigns precise bug tickets to developers, dramatically cutting debugging time and cost.
Introduction
To efficiently discover, locate, and resolve pre‑release issues, the Xianyu team developed an automated exception‑log tracking, locating, and distribution mechanism. It periodically scans logs, precisely pinpoints problematic lines, and automatically assigns them to the responsible developer, reducing development and testing costs.
Why It Was Needed
Because Xianyu lacks a daily environment, most debugging, integration, and verification happen in the pre‑release environment, causing a surge of issues there. Manual filtering and assignment of exception logs required significant effort from both testers and developers.
How the Mechanism Works
1. Filter exception stack information – When an exception is detected, the system records the log content and uses regular expressions to extract stack entries containing the keyword “at”. Each “at” line provides the class path and line number.
2. Extract exception code lines – From the matched stack entries the class name and line number (e.g., AXXXXXXX.java:447) are parsed. Up to five recent stack frames are collected to increase the chance of reaching the developer‑written code.
3. Determine the target branch – The pre‑release environment may have multiple branches; the system retrieves the branch associated with the log and also keeps the master branch as a fallback.
4. Get the Git file path – Using the application’s repository ID, branch name, and class information, the exact file path in the Git repository is obtained.
5. Identify the commit author – Combining repository ID, file path, line number and authentication data, the system queries Git to find the developer who last committed that line.
Finally, the responsible developer receives a precise bug report containing the file, line, and author information, enabling rapid verification and fix.
Conclusion
Every week the system automatically distributes accurate bug tickets to the appropriate developers, filters noise, and produces statistics by application and by person, helping ensure that most exceptions are resolved before reaching production.
Alibaba Cloud Developer
Alibaba's official tech channel, featuring all of its technology innovations.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
