2022-10-11 11:45:14 W/stderr: ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2
- 进入 mirai 根目录
cd /path/to/mirai-console-loader/
- 下载依赖
wget https://repo1.maven.org/maven2/org/slf4j/slf4j-nop/1.7.36/slf4j-nop-1.7.36.jar -P libs
wget https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.12.1/log4j-core-2.12.1.jar -P libs
- 配置下载桥接/接口
cat > plugin-shared-libraries/libraries.txt << EOF
org.slf4j:slf4j-api:1.7.36
net.mamoe:mirai-slf4j-bridge:1.2.0
EOF
- 编辑 log4j2 配置文件
cat > config/log4j2.xml << EOF
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="error">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
EOF
- 写入启动脚本(use Console)
cat > runConsole << EOF
java -cp "./libs/*" -Dlog4j2.configurationFile=config/log4j2.xml net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader \$*
EOF
chmod +x runConsole
- 写入启动脚本(use mcl)
cat > mcl << EOF
#!/usr/bin/env sh
export JAVA_BINARY=java
#\$JAVA_BINARY -jar mcl.jar $*
\$JAVA_BINARY -cp libs/*:mcl.jar -Dlog4j2.configurationFile=config/log4j2.xml org.itxtech.mcl.Loader \$*
EOF
感谢 @StageGurad