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

Improve QTJAMBI_DEBUG_TRACE feature #149

Closed
omix opened this issue May 3, 2023 · 2 comments
Closed

Improve QTJAMBI_DEBUG_TRACE feature #149

omix opened this issue May 3, 2023 · 2 comments
Assignees

Comments

@omix
Copy link
Contributor

omix commented May 3, 2023

The QTJAMBI_DEBUG_TRACE feature is one of the oldest in QtJambi and needs to be revised:

  • Send outprints to Qt's logging mechanism instead of printf
  • Including thread ID
  • Including object pointers
  • Replace env variable by runtime property
  • Allow filters on output
  • Make feature available in release build with least expenses in performance
@omix omix self-assigned this May 3, 2023
@omix
Copy link
Contributor Author

omix commented May 10, 2023

This feature is available in next release QtJambi 6.5.1.

@omix
Copy link
Contributor Author

omix commented May 10, 2023

You may activate method logs by using JVM call parameter -Dio.qt.enable-method-logs=true. This works in both, release and debug build.

QtJambi will log to qDebug() whenever entering and leaving a method as well as further internal states. These messages are logged with different logging categories:

  • io.qtjambi.debugapi.native-calls - a native Qt method is called by Java
  • io.qtjambi.debugapi.java-overloads - an overloading Java method is called by Qt
  • io.qtjambi.debugapi.internal - QtJambi internal methods are called
  • io.qtjambi.debugapi - Further internal messages
    You can use category filters to reduce the output (see here). If you use Java logging for output be aware that QtDebugMsg corresponds to logging level FINEST. When using Java logging you may want to filter method logs by following configuration:
io.qtjambi.debugapi.level=OFF
io.qtjambi.debugapi.native-calls.level=OFF
io.qtjambi.debugapi.java-overloads.level=OFF
io.qtjambi.debugapi.internal.level=OFF

Examples:

Java calling native method:
ENTER: Java calling native method QCoreApplication::applicationName() in thread tid=12345
LEAVE: Java calling native method QCoreApplication::applicationName() in thread tid=12345

ENTER: Java calling native method QEvent::QEvent(QEvent::Type) in thread tid=12345
ENTER: Java calling native method construct QEvent(QEvent::Type) in thread tid=12345
ENTER: Constructor call QEvent::QEvent_shell(QEvent::Type type0) on object 0x16328011420 in thread tid=12345
LEAVE: Constructor call QEvent::QEvent_shell(QEvent::Type type0) on object 0x16328011420 in thread tid=12345
LEAVE: Java calling native method construct QEvent(QEvent::Type) in thread tid=12345
LEAVE: Java calling native method QEvent::QEvent(QEvent::Type) in thread tid=12345
Qt calling overloading Java method:
ENTER: Shell (object: 0x1632800eea0) calling java method QObject::event(QEvent*) in thread tid=12345
LEAVE: Shell (object: 0x1632800eea0) calling java method QObject::event(QEvent*) in thread tid=12345
Internal method calls:
ENTER: QtJambiLink::releaseJavaObject(JNIEnv *env) on object 0x16327e2f750 in thread tid=12345
LEAVE: QtJambiLink::releaseJavaObject(JNIEnv *env) on object 0x16327e2f750 in thread tid=12345
Other messages:
call destructor_function on object 0x7ff8039d76b8 in thread tid=12345

omix added a commit that referenced this issue May 12, 2023
issue #153
issue #152
issue #151
issue #150
issue #149
issue #148
issue #147
omix added a commit that referenced this issue May 25, 2023
issue #158
issue #153
issue #152
issue #151
issue #150
issue #149
issue #148
issue #147
@omix omix closed this as completed May 25, 2023
omix added a commit that referenced this issue Jul 25, 2023
issue #153
issue #152
issue #151
issue #150
issue #149
issue #148
issue #147
omix added a commit that referenced this issue Jul 25, 2023
issue #158
issue #153
issue #152
issue #151
issue #150
issue #149
issue #148
issue #147
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant