Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,10 @@ int main(int argc, char *argv[])
XInitThreads();
}

// 将日志配置提前,以确保所有日志没有遗漏
// 控制台日志尽早注册,确保启动阶段日志不遗漏
//qputenv("QT_LOGGING_RULES", "*.debug=true;*.info=true");
DLogManager::registerConsoleAppender();
DLogManager::registerFileAppender();
qInfo() << "LogFile:" << DLogManager::getlogFilePath();
// 文件日志路径依赖 organizationName/applicationName,必须在设置应用名后再注册

// Task 326583 不参与合成器崩溃重连
unsetenv("QT_WAYLAND_RECONNECT");
Expand Down Expand Up @@ -330,6 +329,10 @@ int main(int argc, char *argv[])
qApp->setOrganizationName("deepin");
//设置应用名称
qApp->setApplicationName("deepin-camera");
// 文件日志依赖 organizationName/applicationName 计算路径,
// 必须在应用名设置完成后再注册,否则会写到 ~/.cache/.log
DLogManager::registerFileAppender();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Startup diagnostics disappear from log

When startup diagnostics are emitted before the file appender is registered, earlier qInfo(), qWarning(), and qDebug() calls run before DLogManager::registerFileAppender(), so they reach only the console and are not replayed to the file; inspecting the persistent log therefore omits startup diagnostics.

Register the file appender after the application name is set but before emitting startup diagnostics.

Prompt for AI agents
In `src/main.cpp` at line 334:

**Startup diagnostics disappear from log**

When startup diagnostics are emitted before the file appender is registered, earlier `qInfo()`, `qWarning()`, and `qDebug()` calls run before `DLogManager::registerFileAppender()`, so they reach only the console and are not replayed to the file; inspecting the persistent log therefore omits startup diagnostics.

Register the file appender after the application name is set but before emitting startup diagnostics.

qInfo() << "LogFile:" << DLogManager::getlogFilePath();
//加载翻译
qApp->loadTranslator(QList<QLocale>() << QLocale::system());
//设置程序名称
Expand Down
Loading