Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-140826

qInstallMessageHandler() does not catch basic QML/JavaScript logs on Android

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.9.3
    • Core: I/O
    • None
    • Android

      so I wanted to store all logs from QML/JavaScript in external db, so sending them over via rest api.

      however, as far as I do:
       

      #include <QLoggingCategory>
      #include <QMainWindow>
      #include <QMessageBox>
      #include <QOperatingSystemVersion>
      #include <QMessageLogContext>
      #include <QSysInfo>
      
      void customMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
      {
          qDebug() << "Something happened";
          qDebug() << msg;
      }
      
      int main(int argc, char *argv[])
      {
          qInstallMessageHandler(customMessageHandler);
          QGuiApplication app(argc, argv);
          ...
      }

       
       
      and then i simply trigger anything by:

      Component.onCompleted: console.log(non_declared_variable)

       
      All works as expected on Windows:

       
      however when build for Android then it prints NOTHING to console (Application Output).
      but if I remove the handler at all, so remove the line:

      qInstallMessageHandler(customMessageHandler);

      then I see the error in debugger:

       
      so why qInstallMessageHandler() does not catch them on Android?
       
      iOS untested

        1. image-2025-10-03-07-52-29-694.png
          3 kB
          Jiri Zaloudek
        2. image-2025-10-03-07-58-43-127.png
          4 kB
          Jiri Zaloudek
        3. main.cpp
          7 kB
          Jiri Zaloudek
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            shokarta Jiri Zaloudek
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes