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

应用添加DLogManager::registerJournalAppender后,使用qCDebug()分类宏无法打印出模块信息,并且有报错提示 #140

Open
starhcq opened this issue Oct 9, 2023 · 4 comments
Assignees

Comments

@starhcq
Copy link

starhcq commented Oct 9, 2023

SUMMARY | 问题概要

1.调用DLogManager::registerJournalAppender(),应用将日志信息注册到journal appener中;
2.使用qCDebug()日志分类宏输出日志信息,观察日志输出内容,有报错提示No appenders assotiated with category main.app.test.module
截图_选择区域_20231009172821

DTK and OS VERSIONS | DTK&系统版本信息

镜像:1061专业版
dtk版本:dtkcore 5.6.8.2-1

Minimal Reproducible Case Code | 最小复现案例代码

Q_LOGGING_CATEGORY(test, "main.app.test.module")
qCDebug(test) << "just test 2";
DLogManager::registerJournalAppender();
qCDebug(test) << "just test 3";

OBSERVED RESULT | 观察到的结果

在打印日志just test 3时,日志中有报错信息:No appenders assotiated with category main.app.test.module

EXPECTED RESULT | 期望的结果

能正常显示分类日志模块信息main.app.test.module

ADDITIONAL INFORMATION | 额外补充

使用DLogManager::registerConsoleAppender()DLogManager::registerFileAppender()都有相同问题。

@18202781743
Copy link
Contributor

调用DLogManager::registerJournalAppender()注册后加上之后就用的是Dtk的日志输出,
DLogManager的输出默认的没有添加category,
需要的话应用可以设置 DLogManager::setLogFormat
image

@18202781743
Copy link
Contributor

@kegechen 需要修改dtk的输出格式么,

@kegechen
Copy link
Contributor

默认不打印 category, 否则会有很多 [ ] ,需要的地方可以主动加一下这个

@kegechen
Copy link
Contributor

后面在优化一下这个format 解析的

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

No branches or pull requests

3 participants