HMCL-dev / HMCL-dev/HMCL

[Feature] 将游戏的控制台输出重定向到文件

Open
#2,663 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
10.1k
Forks
934
Avg merge
1d 5h
Merged PRs (30d)
82

Description

描述 | Description

把游戏运行过程中的控制台输出重定向到某个日志文件,可以是 ~/.hmcl/minecraft.log 之类的地方,这样这个文件可以没有行数限制,而原有的输出到日志界面的行数限制可以不变。
在游戏崩溃之后导出游戏崩溃信息的时候,可以把 minecraft.log 一并打包以代替原先在内存中的控制台输出日志。

原因 | Reason
  • forge 1.13+ 输出到 stdout 的内容不会输出到日志文件里
  • 现有的控制台输出默认行数限制过低导致很多时候游戏崩溃信息中的 minecraft.log 作用不大,而且之前有提高日志行数导致 HMCL 抛 OutOfMemoryError 的案例
  • HMCL 的强制替换 log4j2.xml 的策略导致原先 forge 用自己的 log4j2.xml 能输出的日志反而不输出,给求助者解决问题的时候必须让他加 JVM 参数 -Dlog4j2.formatMsgNoLookups=false 然后重新发日志,浪费人力

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file, test, or entry point is named. Start by locating the game's console-output handling and crash-information export flow, then determine how an unbounded minecraft.log can be stored and packaged without increasing the in-memory limit. Done means stdout is preserved in the file and crash exports include it.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop, observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.