static LogHandler *gErrorData;
static GPtrArray *gDomains = NULL;
static gboolean gLogInitialized = FALSE;
+static gboolean gLoggingStopped = FALSE;
/* Internal functions. */
return;
}
+ if (gLoggingStopped) {
+ /* This is to avoid nested logging in vmxLogger */
+ return;
+ }
+
if (gPanicCount == 0) {
char *msg = Str_Vasprintf(NULL, fmt, args);
if (msg != NULL) {
}
+/**
+ * This is called to avoid nested logging in vmxLogger.
+ */
+
+void
+VMTools_StopLogging(void)
+{
+ gLoggingStopped = TRUE;
+}
+
+
+/**
+ * This is called to reset logging in vmxLogger.
+ */
+
+void
+VMTools_RestartLogging(void)
+{
+ gLoggingStopped = FALSE;
+}
+
+
/**
* Called if vmtools lib is used along with Guestlib SDK.
*/
*******************************************************************************
* VMXLoggerLog -- */ /**
*
- * Logs a message to the VMX using the backdoor.
+ * Logs a message to the VMX using RpcChannel.
*
* The logger uses its own RpcChannel, opening and closing the channel for each
* log message sent. This is not optimal, especially if the application already
VMXLoggerData *logger = data;
g_static_mutex_lock(&logger->lock);
+
+ /*
+ * To avoid nested logging inside of RpcChannel, we need to disable logging
+ * here. See bug 1069390.
+ */
+
+ VMTools_StopLogging();
+
if (RpcChannel_Start(logger->chan)) {
gchar *msg;
gint cnt = VMToolsAsprintf(&msg, "log %s", message);
- /*
- * XXX: RpcChannel_Send() can log stuff in certain situations, which will
- * cause this to blow up. Hopefully we won't hit those too often since
- * we're stopping / starting the channel for each log message.
- */
RpcChannel_Send(logger->chan, msg, cnt, NULL, NULL);
g_free(msg);
RpcChannel_Stop(logger->chan);
}
+
+ VMTools_RestartLogging();
g_static_mutex_unlock(&logger->lock);
}