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

iOS: qSetMessagePattern() does not affect the output from qDebug et al.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.12.0 Alpha
    • Core: I/O
    • None
    • iOS/tvOS/watchOS

      In qDefaultMessageHandler(), on all other OSes and logging systems we call a <system>_message_handler() function, and those call qFormatLogMessage. But on iOS, qFormatLogMessage() isn't being called: we just directly call AppleUnifiedLogger::messageHandler(type, context, message). So, the output of the app in XCode doesn't have the information which is specified in qSetMessagePattern(). I expected that I could do

          qSetMessagePattern("[%{time process} %{if-debug}D%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{category} %{function} - %{message}");
      

      in main.cpp before creating the QGuiApplication, since setting env variables probably doesn't work. (On desktop OSes, I always set the QT_MESSAGE_PATTERN variable. The calling function %{function} is actually what I need the most though, since the xcode output does have some of the other stuff, like timestamp.)

      QTBUG-69450 is the opposite problem, on Android: it was repeating this information. At least the patch helped me figure out where to look.

      Maybe AppleUnifiedLogger outputs the type and context somewhere, but not in the XCode output pane.

        For Gerrit Dashboard: QTBUG-70668
        # Subject Branch Project Status CR V

            srutledg Shawn Rutledge
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes