summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qlogging.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Win: work around (estimated) 32k char limit for OutputDebugStringOliver Wolff2020-02-021-5/+25
| | | | | | | | | | | | Reaching a certain number of characters, OutputDebugString will just eat the string and not give any output. As there is no way of handling that error properly we divide the string into usable chunks. Fixes: QTBUG-80996 Change-Id: Ic7ef34c48c212cbaec3a03790d1020506b7b4319 Reviewed-by: Miguel Costa <miguel.costa@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Don't wrap feature detection macros with QT_HAS_FOO() variantsTor Arne Vestbø2019-12-101-4/+4
| | | | | | | | | | | | | | | | | Using wrappers for these macros is problematic when for example passing the -frewrite-includes flag to preprocess sources before shipping off to distcc or Icecream. It will also start producing warnings when compilers implement http://eel.is/c++draft/cpp.cond#7.sentence-2. See for example https://reviews.llvm.org/D49091 Both https://clang.llvm.org/docs/LanguageExtensions.html and the SD-6 document at https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations recommend defining '__has_foo(x) 0' as a fallback for compilers without the macros, so that's what we go for. Change-Id: I0298cd3b4a6ff6618821e34642a5ddd6728be767 Reviewed-by: Alex Richardson <arichardson.kde@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.13' into 5.14Friedemann Kleint2019-09-091-2/+2
|\ | | | | | | | | | | | | Conflicts: tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp Change-Id: Idd3ca5cb9a2b95a4c3513b2a4c8966e6f56193f1
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-09-081-2/+2
| |\ | | | | | | | | | Change-Id: I371c5ae1af6f58e32e579671f485b92b586e0b76
| | * qFatal: make it so you cannot disable the messageThiago Macieira2019-09-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Solves a few recursion problems in Qt, since then we won't try to inspect the logging registry while creating the logging registry. Fixes: QTBUG-78007 Change-Id: I44cc9ee732f54d2380bafffd15c0f51c7140682e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-09-041-1/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/codecs/qicucodec.cpp src/dbus/qdbusserver.cpp src/gui/painting/qbezier.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp src/plugins/printsupport/cups/qppdprintdevice.cpp Change-Id: I2703128bb64baf5580fbc2c2061b55b0f0611d2a
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-08-221-1/+3
| |\| | | | | | | | | | Change-Id: Ia4bcd81eff948e56a5eda9519cdbee59b7da54d9
| | * Fix qErrnoWarning() printing no error in some conditionsThiago Macieira2019-08-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because it allocates memory, it may call system functions that set errno or Win32's GetLastError(). [ChangeLog][QtCore] Fixed a bug that made qErrnoWarning() say there was no error when generating the error message. Fixes: QTBUG-77322 Change-Id: Ife213d861bb14c1787e1fffd15b811a4f83cf3e7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-07-131-15/+20
| |\| | | | | | | | | | Change-Id: I5d2a4fa33b4aa22da39ac045e6b85ab940b8720b
| | * Optimize and fix handling of QtMessageHandlersMarc Mutz2019-07-111-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A function may almost always have static storage duration, but that does not necessarily mean that we can store and load pointers to them without memory ordering. Play it safe and use store-release and load-acquire for them (which combines to ordered for the fetchAndSet call in qInstall*Handler(), as we don't know what the caller will do with the returned function pointer). Also change the initial value of the atomic pointer to nullptr. Nullptr already signified the default handler in qInstall*Handler(), so the API doesn't change. But by using nullptr to mean default, we place these variables in the BSS segment instead of TEXT, save dynamic init, or at least a relocation, and we dodge the smelly comparison of function pointers, using comparison against nullptr instead. Also, as a drive-by, put the call to ungrabMessageHandler() in a scope-guard. Both the message handler, as well as the Qt code calling it (toLocal8Bit()!), may throw, and that would stop all further logging. In Qt 5.9, we can't use qScopeGuard(), yet, so use a local struct calling ungrabMessageHandler() in its dtor. The code still has one problem: When a logging action is underway, and another thread exchanges the message handler, we might still execute code in the old handler. This is probably not a problem in practice, since no-one will use a dynamically-compiled function for logging (right? :), but should probably be documented or fixed. This patch does not address this issue, though. Change-Id: I21aa907288b9c8c6646787b4001002d145b114a5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit cd401b74a13cd9d9a47d977f195c7985cf725d55) (cherry picked from commit ea16c860bd75a35134ebb1d4f3be5db58f4a4e21)
* | | QtCore: port all QMutexLocker users to qt_{scoped,unique}_lockMarc Mutz2019-08-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... except four instances in QCoreApplication that would conflict with another change. Replace a locally-defined MutexUnlocker with a call to unlock() + qScopedGuard'ed lock() to avoid having to spell out the locker type while we can't depend on C++17 CTAD, yet. In QSettings, move the new mutex locker into and out of initDefaultPaths(), such as is idiomatic for std::unique_lock, but wasn't possible with QMutexLocker (which is not movable). Change-Id: I23056e13ecaa76159db583c7dccc6e05715e0788 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | Optimize and fix handling of QtMessageHandlersMarc Mutz2019-06-231-15/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A function may almost always have static storage duration, but that does not necessarily mean that we can store and load pointers to them without memory ordering. Play it safe and use store-release and load-acquire for them (which combines to ordered for the fetchAndSet call in qInstall*Handler(), as we don't know what the caller will do with the returned function pointer). Also change the initial value of the atomic pointer to nullptr. Nullptr already signified the default handler in qInstall*Handler(), so the API doesn't change. But by using nullptr to mean default, we place these variables in the BSS segment instead of TEXT, save dynamic init, or at least a relocation, and we dodge the smelly comparison of function pointers, using comparison against nullptr instead. Also, as a drive-by, put the call to ungrapMessageHandler() in a scope-guard. Both the message handler, as well as the Qt code calling it (toLocal8Bit()!), may throw, and that would stop all further logging. The code still has one problem: When a logging action is underway, and another thread exchanges the message handler, we might still execute code in the old handler. This is probably not a problem in practice, since no-one will use a dynamically-compiled function for logging (right? :), but should probably be documented or fixed. This patch does not address this issue, though. Change-Id: I21aa907288b9c8c6646787b4001002d145b114a5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Port from QAtomic::load() to loadRelaxed()Giuseppe D'Angelo2019-06-201-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | QMessagePattern: replace manual memory handling with std::unique_ptrMarc Mutz2019-06-131-25/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dealing with 'tokens' is straight-forward. With 'literals', it is not quite so straight-forward, because the ownership chain here is two levels deep. But it's still worthwhile, because it replaces quite error-prone code with code which may be a bit more verbose, but is totally safe. As a drive-by, moved initialization of the fromEnvironment member to the body of the ctor in order to avoid code-churn (I needed to touch the ctor-init-list anyway). The QMessagePattern dtor is now empty and consequently defaulted. Change-Id: Iadb25e7aba1c5a94fd9068be7ae03f17e975328b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | Move away from using 0 as a pointer constantAllan Sandfeld Jensen2019-06-071-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Cleans up most of corelib to use nullptr or default enums where appropriate. Change-Id: Ifcaac14ecdaaee730f87f10941db3ce407d71ef9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QMessageLogContext: rename and improve copy()Giuseppe D'Angelo2019-05-271-18/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "copy" name led me to mis-believe that it was a workaround to the class being non-copiable, and was missing copying a data member. This is instead deliberate; so rename the function to "copyContextFrom", documenting that version won't be copied. The function is still private API, so actually make it private; QMessageLogContext already befriended the only user. Finally, make it return *this (so that it can be chained, if necessary) and noexcept. Change-Id: I3deb3c8edc863a88ac0c37467b144ec2e20db5ca Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-04-101-0/+3
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/win32-clang-msvc/qmake.conf src/gui/image/qpnghandler.cpp Change-Id: Ied79d02912ffb3a307a99483df7db08c7f9d0cd8
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-061-0/+3
| |\| | | | | | | | | | Change-Id: Iec860bb703f983b7438e67c695b9c454e72b3e0f
| | * Add tracepoint to qt_message_printMilian Wolff2019-04-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to deduce a lot about what a Qt application is doing, since the debug output usually contains a lot of information. Change-Id: I28a18afd151a1640a44ba8c7c9cd87d5d66c99b0 Reviewed-by: Christoph Sterz <christoph.sterz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-031-3/+3
|/ / | | | | | | | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* / Fix can not -> cannotRobert Loehning2019-02-251-1/+1
|/ | | | | Change-Id: Ie9992f67ca59aff662a4be046ace08640e7c2714 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Unbreak the build with ICC on WindowsThiago Macieira2018-11-211-1/+1
| | | | | | | | | | qlogging.obj : error LNK2019: unresolved external symbol __fastfail referenced in function "void __cdecl qt_message_fatal(enum QtMsgType,class QMessageLogContext const &,class QString const &)" (?qt_message_fatal@@YAXW4QtMsgType@@AEBVQMessageLogContext@@AEBVQString@@@Z) Fixes: QTBUG-71868 Change-Id: I42a48bd64ccc41aebf84fffd156590a93fe9da53 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Move literal code block to a separate fileCristian Maureira-Fredes2018-10-151-3/+1
| | | | | | | | | | | We need to override this snippet for the documentation we generate for Qt for Python, and it is easier to have it on a separate file. Task-number: PYSIDE-801 Task-number: PYSIDE-691 Change-Id: Ideb5b6af25024279f167137d3b65660bb9c96a7e Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-301-3/+1
|\ | | | | | | Change-Id: Iaa438d14357be1bf75bb645cb8d3245947c055b8
| * Android: fix log output patternLuka Modric2018-09-271-3/+1
| | | | | | | | | | | | | | | | | | | | Remove hardcoded android log pattern as this is already part of the message to match behavior on other platforms. Task-number: QTBUG-69450 Change-Id: I529b550114a2164beafe305f8392891c4ead88f0 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Remove codepaths and checks for unsupported Apple platformsTor Arne Vestbø2018-08-311-2/+1
| | | | | | | | | | | | | | We no longer support macOS 10.11, iOS/tvOS 10, or watchOS 3. Change-Id: Ide03d8fac06185ef4162ba75ee54a0adf6916905 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | WebAssembly for QtBaseMorten Johan Sørvig2018-08-301-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | This is the squashed diff from wip/webassembly to dev. Done-with: Peng Wu <peng.wu@intopalo.com> Done-with: Sami Enne <sami.enne@intopalo.com> Done-with: Morten Johan Sørvig <morten.sorvig@qt.io> Started-by: Andrew Knight <andrew.knight@intopalo.com> Change-Id: I6562433c0a38d6ec49ab675e0f104f2665f3392d Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Make local symbols of some leaked namesThiago Macieira2018-08-031-1/+1
| | | | | | | | | | | | | | | | | | Unnamed namespaces and static are great tools. Use them. Change-Id: Ie01831ddac5446fdbdeefffd15468b3acb3ced79 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QLogging: make QRegularExpression objects static constGiuseppe D'Angelo2018-08-031-3/+3
| | | | | | | | | | | | | | To avoid recompiling them multiple times. Change-Id: Ie4766be3bbaa536bf22b0eaacc430055fe4651cd Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
* | Remove a deprecation warning coming from QRegularExpressionGiuseppe D'Angelo2018-07-211-2/+1
| | | | | | | | | | | | | | The flag is deprecated. Change-Id: Idfd7c31278032ee96b27f3f447a97ecfdd8051af Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | qFatal: Prevent deadlocks on WindowsThiago Macieira2018-05-021-1/+28
|/ | | | | | | | | | | | | | | | | | We began using abort() on 25d6f312ac5b42a6bbca4d1c3c06742d97283e14 (5.8), which improved since we stopped using exit() with MSVC. However, abort() with MinGW and on debug-mode MSVC's CRT calls _exit(), which attempts to cleanly unload the DLLs, which in turn may run global destructors. [ChangeLog][QtCore][Important behavior changes] qFatal() no longer uses std::abort() on Windows, as there are circumstances where global destructors are still run after that call, leading to possible deadlocks. Task-number: QTBUG-34460 Change-Id: I2bec439d0e9841f58c7ffffd152200e45f1df982 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Doc: Mark local functions in qlogging.cpp as internalKai Koehne2018-04-231-0/+3
| | | | | | | This fixes qdoc warnings introduced by 67d5f79fe6f86726eff. Change-Id: I4b199e6243d9a7706befe4bc9549c78c11026d9e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Modernize the "regularexpression" featureUlf Hermann2018-03-201-2/+2
| | | | | | | | | | | | | Use QT_CONFIG(regularexpression), disentangle it from QT_BOOTSTRAPPED, switch it off in the bootstrap build, remove the #ifdefs from qregularexpression.{h|cpp}, and add QT_REQUIRE_CONFIG(regularexpression) to the header. qregularexpression.{h|cpp} are already correctly excluded in tools.pri if !qtConfig(regularexpression). Change-Id: I21de154a6a118b76f99003d3acb72ac1e220d302 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* logging: Clarify and document how we look for the presence of a consoleTor Arne Vestbø2018-03-071-52/+99
| | | | | | | | | | | | | The privately exported qt_logging_to_console() function has been renamed to shouldLogToStderr, and exported in the QtPrivate namespace for QtTestLib. [ChangeLog][Important behavior changes][Logging (including qDebug and qWarning)] The QT_LOGGING_TO_CONSOLE environment variable has been deprecated. Use the more specific QT_ASSUME_STDERR_HAS_CONSOLE or QT_FORCE_STDERR_LOGGING, depending on your usecase. Change-Id: Ie29228eeac3b700c3de94fee022d5d66d9b5c210 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.11Liang Qi2018-02-141-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/animation/qvariantanimation.cpp src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/corelib/io/qprocess_win.cpp src/corelib/json/qjsonarray.cpp src/corelib/tools/qsimd_p.h src/corelib/tools/qtimezoneprivate_p.h src/corelib/xml/qxmlstream_p.h src/gui/kernel/qsimpledrag.cpp src/gui/kernel/qsimpledrag_p.h src/plugins/generic/generic.pro src/plugins/platforms/cocoa/qcocoamenu.mm src/widgets/styles/qmacstyle_mac.mm tests/auto/concurrent/qtconcurrentmap/BLACKLIST tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qmessagebox/BLACKLIST Change-Id: I508d686cf20f7f8cc6a7119b9bc7c3bbb505c58e
| * Support for Q_OS_ANDROID_EMBEDDED and android-embedded build flagsOtto Ryynänen2018-01-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The Embedded Android build (Boot to Qt Android injection) is defined by having both Q_OS_ANDROID and Q_OS_ANDROID_EMBEDDED flags defined, as well as having Qt config android-embedded. This commit enables the possibility to build embedded Android builds. (i.e. Qt build for Android baselayer only, without JNI) Change-Id: I8406e959fdf1c8d9efebbbe53f1a391fa25f336a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | Add support for Apple Unified LoggingTor Arne Vestbø2018-02-121-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the OS supports it, we will now log to the Apple unified logging system in addition to the normal stderr output. These logs can be inspected via the Console application, or the 'log' command line tool. See https://developer.apple.com/documentation/os/logging [ChangeLog][QtCore] Apple Unified Logging is now supported on Apple platforms. Task-number: QTBUG-38156 Done-with: Jake Petroules <jake.petroules@qt.io> Change-Id: I2ab92bd192d5b98aaf77e41501ea7b1ca6ef2425 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | logging: Break out stderr logging sink into separate functionTor Arne Vestbø2018-02-111-13/+16
| | | | | | | | | | Change-Id: I4bc476376d2b84297c1798b016017db496532d27 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | logging: Don't build alternate logging sinks for QT_BOOTSTRAPPEDTor Arne Vestbø2018-02-111-7/+13
| | | | | | | | | | | | | | | | | | This means willLogToConsole does not need to consider the boostrapped case anymore. Change-Id: I088245362cd46c582a2a08225d22e4d2e4645c06 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | logging: Break out QMessagePattern error reporting into standalone functionTor Arne Vestbø2018-02-111-14/+20
| | | | | | | | | | | | | | | | Makes for a less awkward logic without any if (0) etc. Change-Id: I3db0984c5a0bbf1615c2feb2ebef59b4ec16e9ae Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | logging: Use !QT_BOOTSTRAPPED instead of QT_BUILD_CORE_LIBTor Arne Vestbø2018-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The former is the preferred way in Qt to exclude code that shouldn't be built for bootstrap tools. For qlogging.cpp this includes the bootstrap library, and qmake, both of which have QT_BOOTSTRAPPED defined. Change-Id: I94b669aae308786eded92b30b5e3f63add069756 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | logging: Group alternate logging sink implementationsTor Arne Vestbø2018-02-091-58/+62
| | | | | | | | | | Change-Id: Iac703559658edf16c56f4c54cf71cd6188d1db4e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Prevent duplicated log output when using alternate logging sinksTor Arne Vestbø2018-02-081-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3d02e75c07f was too quick, and didn't account for the fact that the old code had early returns for each alternate logging sink, so when removing the qt_logging_to_console() check, we would end up writing debug output twice. This is due to e.g. Qt Creator running the application without a console, so qt_logging_to_console() returns false, so we end up in e.g. the win_message_handler(), calling OutputDebugString, but then we unconditionally print to stderr, which Creator also reads, so we end up with duplicated log messages. Change-Id: I91573828576608643477ae27d36d7e819f92985d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix inverted logic in slog2 log handler for when to disable loggingTor Arne Vestbø2018-02-081-1/+1
| | | | | | | | | | | | | | | | If we are logging to the console, we should _not_ log to slog2, like the other log backends. Change-Id: I6d16704c0f0923f54b3dc030d374af9805c2af06 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Unconditionally log to stderr, regardless of qt_logging_to_console()Tor Arne Vestbø2018-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Regression after 114f7952217c9c, which incorrectly assumed that checking qt_logging_to_console() was a safe behavior change to include. Unfortunately that broke debug output in Qt Creator, as Creator doesn't seem to run applications with a controlling TTY unless it itself was started with one, and doesn't set QT_LOGGING_TO_CONSOLE to force log console output either. Task-number: QTBUG-66153 Change-Id: I775cb06953122a3f20c16bfe21e19de2d1aa5b52 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | logging: Factor out how to determine if a category is the default categoryTor Arne Vestbø2018-01-161-2/+7
| | | | | | | | | | Change-Id: I00a94c8c3ce2c0cba5263e6fbc499794dc7ef38f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix QNX 7 buildTor Arne Vestbø2018-01-141-2/+2
| | | | | | | | | | | | | | | | Missing return value after 114f795221. Task-number: QTBUG-65747 Change-Id: I8881fc70f76a163e7b1f032c7a7485ab09f852b1 Reviewed-by: Liang Qi <liang.qi@qt.io>
* | logging: Break out alternative logging sinks into a well defined APITor Arne Vestbø2018-01-121-30/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First steps towards a public API for having multiple output sinks is to allow this internally. We give all the different log sinks the same signature, with a bool return value to signify if stderr has been handled. The logic of not logging to the alternative sinks when the function qt_logging_to_console() returns true has been moved into each sink, so that they in the future may choose to log even when also logging to the console, allowing multi-sink output. They must then make sure to return true if the native logging sink has also logged to stderr. The logic of each sink has been kept the same when it comes to the formatting of the message. Some of these sinks should ideally use the raw message instead of the formatted one, as they are structured logging sinks. Change-Id: I441d3bc1db3e16180704e00d13a40564b6f06a6c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | logging: Clarify that QT_MESSAGE_PATTERN only applies to unstructured loggingTor Arne Vestbø2018-01-121-0/+4
| | | | | | | | | | | | | | | | | | Structured sinks such as systemd should capture each piece of information individually, not bake it into the message via the message pattern. Change-Id: I164c043683f123764a5445dc9faad049e25fd738 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10Lars Knoll2017-12-301-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/win32-g++/qmake.conf src/corelib/global/qglobal_p.h src/corelib/global/qoperatingsystemversion_p.h src/corelib/io/qfilesystemengine_win.cpp src/network/bearer/qbearerengine.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/sql/doc/snippets/code/doc_src_sql-driver.cpp src/widgets/kernel/qwidget_p.h src/widgets/kernel/qwidgetwindow.cpp src/widgets/styles/qfusionstyle.cpp tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp Change-Id: I80e2722f481b12fff5d967c28f89208c0e9a1dd8