本页面内容

查看内部日志

您可以在运行时查看Qt Creator 的内部日志消息,而无需重启该服务或配置日志规则。日志消息在开发Qt Creator 、排查遇到的问题或了解后台运作机制时非常有用。

要打开日志查看器并开始收集日志信息,请选择Tools > Debug Qt Creator > “Show Logs ”。

日志类别查看器对话框

查看器将显示所选日志类别的日志消息。如果您已定义日志规则,这些规则可能会在启动时列出。否则,在使用Qt Creator 时,类别列表会随着使用过程而扩展。

注意:消息 不会被缓存,因此查看器仅显示您启用某类别后记录的消息。

查看日志

要启用日志类别,请在“Category ”中选择相应类别。要指定要显示的该类别消息级别,请选择DebugWarningCriticalInfoFatal 级别的消息始终处于启用状态。

如果您启用了多个类别,可以为每个类别的消息指定不同的颜色。双击Color 的值,为各类别选择颜色。

要保存当前启用类别的信息,请在上下文菜单中选择“Save Enabled as Preset ”。要加载已保存的信息,请选择“Update from Preset ”。

要保存显示的消息内容,请选择“保存日志 ”(Save Log )。要复制所有或选中的消息,请在上下文菜单中选择“Copy All ”或“Copy Selected Logs ”。

要清除显示的消息内容,请选择“清除 ”(Clear )。

要暂时停止日志记录,请选择“停止记录 ”(Stop Logging )。要继续日志记录,请选择““运行”按钮 ”(Start Logging )。

在搜索框中使用正则表达式过滤类别。默认情况下,直接来自 Qt XML 的日志类别和消息会被过滤掉。要显示它们,请选择“明文 ”(Clear text )或手动清空搜索框。要再次隐藏它们,请选择“过滤 Qt 内部日志类别 ”(Filter Qt Internal Logging Categories )。

新消息会出现时,消息显示区域会自动滚动至底部。若要停止自动滚动,请切换“自动滚动 ”(Auto Scroll )。

默认情况下,消息列表显示时间戳,但不显示消息类型。要隐藏或显示此信息,请切换时间戳Timestamps )和消息类型Message Types )。

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.