Skip to content

Fix main_class displaying extra arguments on Arthas startup#3150

Merged
hengyunabc merged 2 commits intomasterfrom
copilot/fix-arthas-main-class-logging
Mar 13, 2026
Merged

Fix main_class displaying extra arguments on Arthas startup#3150
hengyunabc merged 2 commits intomasterfrom
copilot/fix-arthas-main-class-logging

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 9, 2026

sun.java.command contains the full launch command — main class name followed by all application arguments — but was being used as-is for main_class, producing output like:

main_class   org.springframework.boot.loader.JarLauncher --server.port=7001

Change

  • PidUtils.java: Extract only the first token from sun.java.command (split on first space), so mainClass() returns just the class/jar name without any trailing arguments.
String command = System.getProperty("sun.java.command", "");
int spaceIndex = command.indexOf(' ');
MAIN_CLASS = spaceIndex != -1 ? command.substring(0, spaceIndex) : command;
Original prompt

This section details on the original issue you should resolve

<issue_title>arthas 启动时,获取的 main class 打印信息有多余部分</issue_title>
<issue_description>main_class org.springframework.boot.loader.JarLauncher --server.port=7001</issue_description>

<agent_instructions>排查一下为什么 arthas 启动时打印的 main_class 有可能有多余的信息</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Co-authored-by: hengyunabc <1683936+hengyunabc@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix excess information in main class logging for Arthas startup Fix main_class displaying extra arguments on Arthas startup Mar 9, 2026
@hengyunabc hengyunabc marked this pull request as ready for review March 13, 2026 06:38
@hengyunabc hengyunabc merged commit 7edd529 into master Mar 13, 2026
1 check was pending
@hengyunabc hengyunabc deleted the copilot/fix-arthas-main-class-logging branch March 13, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arthas 启动时,获取的 main class 打印信息有多余部分

3 participants