Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

同时设置redirectBotLogToDirectory()、redirectNetworkLogToDirectory(),日志文件中都为Net日志 #1743

Closed
imldy opened this issue Dec 16, 2021 · 0 comments · Fixed by #1751
Labels
M 优先级: 主要 t:bug 类型: bug
Milestone

Comments

@imldy
Copy link

imldy commented Dec 16, 2021

问题描述

// 设置工作目录
File workingDir = new File("mirai/");
workingDir.mkdir();
BotConfiguration botConfiguration = new BotConfiguration() {{
            setWorkingDir(workingDir);
            setProtocol(MiraiProtocol.ANDROID_WATCH);
            // 重定向日志
            redirectBotLogToDirectory();
            redirectNetworkLogToDirectory();
        }};

日志文件中,日志类别都变成了Net

这是开启重定向和注释掉重定向的两行代码之后的区别:

image

复现

BotConfiguration设置:

redirectBotLogToDirectory();
redirectNetworkLogToDirectory();

mirai-core 版本

2.8.2

bot-protocol

ANDROID_WATCH

其他组件版本

系统日志

开启日志重定向到目录:


�[92m2021-12-16 13:24:04 I/Net BotQQ号: Bot login successful.�[0m
�[0m2021-12-16 13:24:04 V/Net BotQQ号: Send: MessageSvc.PbSendMsg(MessageSvc.PbSendMsg)�[0m
�[0m2021-12-16 13:24:04 V/Net BotQQ号: Friend(QQ大号) <- 登录成功2,好友消息�[0m
�[0m2021-12-16 13:24:04 V/Net BotQQ号: Recv: MessageSvc.PbSendMsg�[0m
�[0m2021-12-16 13:24:04 V/Net BotQQ号: Send: StatSvc.register(offline)�[0m
�[92m2021-12-16 13:24:04 I/Net BotQQ号: Bot cancelled: Job was cancelled�[0m

不开重定向:

2021-12-16 13:25:17 I/Bot BotQQ号: Bot login successful.
2021-12-16 13:25:17 V/Net BotQQ号: Send: MessageSvc.PbSendMsg(MessageSvc.PbSendMsg)
2021-12-16 13:25:17 V/Bot BotQQ号: Friend(QQ大号) <- 登录成功2,好友消息
2021-12-16 13:25:17 V/Net BotQQ号: Recv: MessageSvc.PbSendMsg
2021-12-16 13:25:17 V/Net BotQQ号: Send: StatSvc.register(offline)
2021-12-16 13:25:17 I/Bot BotQQ号: Bot cancelled: Job was cancelled


### 网络日志

```text
1

补充信息

No response

@imldy imldy added the x:question 标签: 需要更多信息 label Dec 16, 2021
@Him188 Him188 added t:bug 类型: bug M 优先级: 主要 and removed x:question 标签: 需要更多信息 labels Dec 18, 2021
@Him188 Him188 added this to the 2.10.0-RC milestone Dec 18, 2021
StarWishsama added a commit to StarWishsama/mirai that referenced this issue Dec 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M 优先级: 主要 t:bug 类型: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants