if (virErrorLogPriorityFilter)
priority = virErrorLogPriorityFilter(to, priority);
- virLogMessage(virErrorLogPriorityFilter ? VIR_LOG_FROM_FILE : VIR_LOG_FROM_ERROR,
- priority,
- filename, linenr, funcname,
- meta, "%s", str);
+ /* We don't want to pollute stderr if no logging outputs
+ * are explicitly requested by the user, since the default
+ * error function already pollutes stderr and most apps
+ * hate & thus disable that too. If the daemon has set
+ * a priority filter though, we should always forward
+ * all errors to the logging code.
+ */
+ if (virLogGetNbOutputs() > 0 ||
+ virErrorLogPriorityFilter)
+ virLogMessage(VIR_LOG_FROM_ERROR,
+ priority,
+ filename, linenr, funcname,
+ meta, "%s", str);
errno = save_errno;
}
str, msg, virLogOutputs[i].data);
}
}
- if ((virLogNbOutputs == 0) && (source != VIR_LOG_FROM_ERROR)) {
+ if (virLogNbOutputs == 0) {
if (logVersionStderr) {
const char *rawver;
char *ver = NULL;