I currently call qInstallMsgHandler()
to redirect all Qt Errors, Warnings, and Debug output to my own message handler.
This works 99% of the time but when executing SQL statements through the QSqlQuery object I still get the following output to stderr:
**WARNING: nonstandard use of \\ in a string literal
LINE 1: EXECUTE qpsqlpstmt_11 ('<?xml version=''1.0'' encoding=''U
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.**
The database is PostgresSQL version 8.4. Any ideas how I can also intercept and redirect this warning?
It seems that some PostgreSQL library which is being used by the Qt driver writes to stderr
.
Yan can redicrect stderr
like this:
freopen("my_log.txt", "w", stderr);