General and Desktop
2017.01.13 00:41

Qt Logging Rule, Qt 프레임워크 로그 출력

조회 수 12377 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

로깅 규칙을 사용하면 Qt 프레임워크 로그 범주를 유연하게 활성화 또는 비활성화 할 수 있다.

 

Qt 5.3부터 로깅 규칙은 QT_LOGGING_RULES 환경 변수에서 설정하거나 로깅 구성파일에 명시할 수 있는데, 실행시 로깅 구성 파일의 [Rules] 섹션에서 자동으로 로드된다. 이러한 구성 파일은 QtProject 구성 디렉토리에서 찾고 QT_LOGGING_CONF 환경 변수에 명시적으로 설정된다.

 

아래는 scenegraph관련 로깅을 위해 qtlogging.ini 명시하였다. 

QtProject/qtlogging.ini
[Rules]
*.debug=false
qt.scenegraph.*=true
 

다른 방법으로 setFilterRules() 함수를 호출할 수 도있다.

아래는 QPA 플랫폼을 확인하기 위해 소스코드에서 setFilterRules()을 이용하여 로깅룰을 설정한 예이다.

#include <QLoggingCategory>
 
int main(int argc, char *argv[])
{
    ...
    QLoggingCategory::setFilterRules(QStringLiteral("qt.qpa.*=true"));
    ...
}
 

또는 아래와 같은 방법들도 있다.

 

환경변수에 정의한 ini안에 [Rules] 섹션에 정의하는 방법 (Qt 5.3부터)

qputenv("QT_LOGGING_CONF","C:/Project/test_config.ini");

test_config.ini

[Rules]
*.debug=false
qt.scenegraph.*=true

 

QT_LOGGING_RULES환경변수에 정의하는 방법 (Qt 5.3부터)

qputenv("QT_LOGGING_RULES", "qt.scenegraph*=true");

 

QLoggingCategory클래스에 대한 자세한 정보 및 다른 방법들은 아래 링크참조.

http://doc.qt.io/qt-5/qloggingcategory.html


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 QML and Qt Quick Qt프로그래밍(QtQuick) Beginner를 위한 글 읽는 순서 운영자 2019.01.05 131099
180 QML and Qt Quick z-order 를 컨트롤 하기위한 방법 makersweb 2015.05.13 14186
179 QML and Qt Quick Qml 사용자 ScrollBar 구현 file makersweb 2015.07.24 11806
178 C++ Class QQuickImageProvider 를 이용한 Qml 에서 이미지 표시 makersweb 2015.10.18 11137
177 General and Desktop Qt의 시그널 슬롯 시스템 file makersweb 2015.10.20 31310
176 General and Desktop Qt의 스레드간 시그널 슬롯의 커넥션타입 1 makersweb 2015.10.24 17358
175 General and Desktop Qt 프로그래밍의 시작 makersweb 2015.10.25 21383
174 QtConcurrent를 이용하여 쓰레드를 만드는 방법과 MapReduce file makersweb 2016.01.24 14387
173 Installation and Deployment Ubuntu Linux에서 Qt Creator 설치 file makersweb 2016.03.06 17243
172 General and Desktop 멀티 스레드환경, 스레드에 안전한 이벤트처리 makersweb 2016.10.27 10717
171 QString 문자열에서 숫자만 추출해서 QString으로 반환 makersweb 2017.01.10 12288
» General and Desktop Qt Logging Rule, Qt 프레임워크 로그 출력 makersweb 2017.01.13 12377
169 General and Desktop 타임스탬프( timestamp) 유닉스 시간 makersweb 2017.10.19 9294
168 Mobile and Embedded QPA 플러그인과 EGLFS file makersweb 2017.11.21 12200
167 QML and Qt Quick QML에서 undefined를 확인하는 방법 makersweb 2017.11.29 9187
166 General and Desktop 임의의 메모리 영역(QImage)에 QPainter를 이용하여 그리기 file makersweb 2017.12.19 10079
165 Mobile and Embedded QPA 플러그인과 HTML5 Backend file makersweb 2017.12.27 8444
164 Installation and Deployment Qt 3D Studio 시작하기 file makersweb 2018.01.11 8417
163 General and Desktop Qt 어플리에이션 전역에 폰트 설정 makersweb 2018.01.24 11944
162 General and Desktop 다국어 지원 어플리케이션 개발 file makersweb 2018.01.27 9906
161 Installation and Deployment Windows환경에서 mingw로 Qt 5.10 정적(static)빌드 file makersweb 2018.02.01 10587
Board Pagination Prev 1 2 3 4 5 9 Next
/ 9