{"id":2215808,"url":"http://patchwork.ozlabs.org/api/patches/2215808/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260325110900.2065942-1-eashurov@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260325110900.2065942-1-eashurov@redhat.com>","list_archive_url":null,"date":"2026-03-25T11:08:59","name":"[v3,1/2] qga: replace slog() with standard GLib logging","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"12e4e70589fe27caa1066a18472475f687b4edde","submitter":{"id":91084,"url":"http://patchwork.ozlabs.org/api/people/91084/?format=json","name":"Elizabeth Ashurov","email":"eashurov@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260325110900.2065942-1-eashurov@redhat.com/mbox/","series":[{"id":497421,"url":"http://patchwork.ozlabs.org/api/series/497421/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=497421","date":"2026-03-25T11:08:59","name":"[v3,1/2] qga: replace slog() with standard GLib logging","version":3,"mbox":"http://patchwork.ozlabs.org/series/497421/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2215808/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2215808/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=NYZ96IRo;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgkhK3B5Qz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 22:09:53 +1100 (AEDT)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w5M7C-00018k-B6; Wed, 25 Mar 2026 07:09:34 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <eashurov@redhat.com>)\n id 1w5M7A-00018X-Jx\n for qemu-devel@nongnu.org; Wed, 25 Mar 2026 07:09:32 -0400","from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <eashurov@redhat.com>)\n id 1w5M77-0002hu-NN\n for qemu-devel@nongnu.org; Wed, 25 Mar 2026 07:09:32 -0400","from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-48-xTmRGIJQMa-XM35wnQ723Q-1; Wed,\n 25 Mar 2026 07:09:26 -0400","from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id F1A70180034F\n for <qemu-devel@nongnu.org>; Wed, 25 Mar 2026 11:09:25 +0000 (UTC)","from eashurov-thinkpadx1carbongen12.raanaii.csb (unknown\n [10.47.238.180])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with\n ESMTPS\n id E758D1955F2E; Wed, 25 Mar 2026 11:09:23 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1774436968;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding;\n bh=ER+6eVy2i8wo+kSqgzP5AtDhQyBhdJZqwozpLL45S7s=;\n b=NYZ96IRoh4S1Vz7E5Fv9jXFQUSnWnWxBZBy7wXHkPC7TeKraZw0EHbrjAKtLFARZ4CoiZX\n fJQd46xlaTC1W3SujPuAdshaFCfOYqeB3vjaS0nnTIbWztn+sojOd32MGlLwfgahHal+8M\n pbnqFe05WcVDUNXQDYqQpq6/+UkLJ90=","X-MC-Unique":"xTmRGIJQMa-XM35wnQ723Q-1","X-Mimecast-MFC-AGG-ID":"xTmRGIJQMa-XM35wnQ723Q_1774436966","From":"Elizabeth Ashurov <eashurov@redhat.com>","To":"qemu-devel@nongnu.org","Cc":"berrange@redhat.com, kkostiuk@redhat.com, yvugenfi@redhat.com,\n Elizabeth Ashurov <eashurov@redhat.com>","Subject":"[PATCH v3 1/2] qga: replace slog() with standard GLib logging","Date":"Wed, 25 Mar 2026 13:08:59 +0200","Message-ID":"<20260325110900.2065942-1-eashurov@redhat.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.12","Received-SPF":"pass client-ip=170.10.133.124;\n envelope-from=eashurov@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"Replace qga-specific slog() calls with standard GLib logging APIs.\nUse g_info() for command execution messages and g_warning() for\nnon-fatal failures, and remove the use of \"syslog\" as a log domain.\n\nRework ga_log() to route messages to the log file and\nsyslog/Event Viewer, filtering by log level. Debug messages are\nexcluded from syslog even with --debug.\n\n- Default log level includes ERROR, CRITICAL, and WARNING\n- -v/--verbose enables MESSAGE and INFO\n- --debug enables all levels including DEBUG\n\nSigned-off-by: Elizabeth Ashurov <eashurov@redhat.com>\n---\n qga/commands-linux.c   |  6 ++---\n qga/commands-posix.c   | 26 +++++++++---------\n qga/commands-win32.c   | 60 +++++++++++++++++++++---------------------\n qga/commands.c         | 29 ++++++--------------\n qga/guest-agent-core.h |  1 -\n qga/main.c             | 39 +++++++++++++++++++--------\n 6 files changed, 82 insertions(+), 79 deletions(-)","diff":"diff --git a/qga/commands-linux.c b/qga/commands-linux.c\nindex 378f4d080c..a722de2e6a 100644\n--- a/qga/commands-linux.c\n+++ b/qga/commands-linux.c\n@@ -44,7 +44,7 @@ static int dev_major_minor(const char *devpath,\n     *devminor = 0;\n \n     if (stat(devpath, &st) < 0) {\n-        slog(\"failed to stat device file '%s': %s\", devpath, strerror(errno));\n+        g_warning(\"failed to stat device file '%s': %s\", devpath, strerror(errno));\n         return -1;\n     }\n     if (S_ISDIR(st.st_mode)) {\n@@ -1158,7 +1158,7 @@ qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)\n     int fd;\n     struct fstrim_range r;\n \n-    slog(\"guest-fstrim called\");\n+    g_info(\"guest-fstrim called\");\n \n     QTAILQ_INIT(&mounts);\n     if (!build_fs_mount_list(&mounts, errp)) {\n@@ -2072,7 +2072,7 @@ GuestCpuStatsList *qmp_guest_get_cpustats(Error **errp)\n         }\n \n         if (i < 5) {\n-            slog(\"Parsing cpu stat from %s failed, see \\\"man proc\\\"\", cpustats);\n+            g_warning(\"Parsing cpu stat from %s failed, see \\\"man proc\\\"\", cpustats);\n             break;\n         }\n \ndiff --git a/qga/commands-posix.c b/qga/commands-posix.c\nindex 837be51c40..96939a6f36 100644\n--- a/qga/commands-posix.c\n+++ b/qga/commands-posix.c\n@@ -240,7 +240,7 @@ void qmp_guest_shutdown(const char *mode, Error **errp)\n     const char *reboot_flag = \"-r\";\n #endif\n \n-    slog(\"guest-shutdown called, mode: %s\", mode);\n+    g_info(\"guest-shutdown called, mode: %s\", mode);\n     if (!mode || strcmp(mode, \"powerdown\") == 0) {\n         if (access(POWEROFF_CMD_PATH, X_OK) == 0) {\n             shutdown_cmd = POWEROFF_CMD_PATH;\n@@ -519,7 +519,7 @@ int64_t qmp_guest_file_open(const char *path, const char *mode,\n     if (!mode) {\n         mode = \"r\";\n     }\n-    slog(\"guest-file-open called, filepath: %s, mode: %s\", path, mode);\n+    g_info(\"guest-file-open called, filepath: %s, mode: %s\", path, mode);\n     fh = safe_open_or_create(path, mode, &local_err);\n     if (local_err != NULL) {\n         error_propagate(errp, local_err);\n@@ -540,7 +540,7 @@ int64_t qmp_guest_file_open(const char *path, const char *mode,\n         return -1;\n     }\n \n-    slog(\"guest-file-open, handle: %\" PRId64, handle);\n+    g_info(\"guest-file-open, handle: %\" PRId64, handle);\n     return handle;\n }\n \n@@ -549,7 +549,7 @@ void qmp_guest_file_close(int64_t handle, Error **errp)\n     GuestFileHandle *gfh = guest_file_handle_find(handle, errp);\n     int ret;\n \n-    slog(\"guest-file-close called, handle: %\" PRId64, handle);\n+    g_info(\"guest-file-close called, handle: %\" PRId64, handle);\n     if (!gfh) {\n         return;\n     }\n@@ -645,7 +645,7 @@ GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64,\n     write_count = fwrite(buf, 1, count, fh);\n     if (ferror(fh)) {\n         error_setg_errno(errp, errno, \"failed to write to file\");\n-        slog(\"guest-file-write failed, handle: %\" PRId64, handle);\n+        g_warning(\"guest-file-write failed, handle: %\" PRId64, handle);\n     } else {\n         write_data = g_new0(GuestFileWrite, 1);\n         write_data->count = write_count;\n@@ -760,7 +760,7 @@ static void execute_fsfreeze_hook(FsfreezeHookArg arg, Error **errp)\n \n     const char *argv[] = {hook, arg_str, NULL};\n \n-    slog(\"executing fsfreeze hook with arg '%s'\", arg_str);\n+    g_info(\"executing fsfreeze hook with arg '%s'\", arg_str);\n     ga_run_command(argv, NULL, \"execute fsfreeze hook\", &local_err);\n     if (local_err) {\n         error_propagate(errp, local_err);\n@@ -793,7 +793,7 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints,\n     FsMountList mounts;\n     Error *local_err = NULL;\n \n-    slog(\"guest-fsfreeze called\");\n+    g_info(\"guest-fsfreeze called\");\n \n     execute_fsfreeze_hook(FSFREEZE_HOOK_FREEZE, &local_err);\n     if (local_err) {\n@@ -833,7 +833,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **errp)\n \n     if (ret >= 0) {\n         ga_unset_frozen(ga_state);\n-        slog(\"guest-fsthaw called\");\n+        g_info(\"guest-fsthaw called\");\n         execute_fsfreeze_hook(FSFREEZE_HOOK_THAW, errp);\n     } else {\n         ret = 0;\n@@ -849,8 +849,8 @@ static void guest_fsfreeze_cleanup(void)\n     if (ga_is_frozen(ga_state) == GUEST_FSFREEZE_STATUS_FROZEN) {\n         qmp_guest_fsfreeze_thaw(&err);\n         if (err) {\n-            slog(\"failed to clean up frozen filesystems: %s\",\n-                 error_get_pretty(err));\n+            g_warning(\"failed to clean up frozen filesystems: %s\",\n+                      error_get_pretty(err));\n             error_free(err);\n         }\n     }\n@@ -1282,19 +1282,19 @@ static GKeyFile *ga_parse_osrelease(const char *fname)\n     const char *group = \"[os-release]\\n\";\n \n     if (!g_file_get_contents(fname, &content, NULL, &err)) {\n-        slog(\"failed to read '%s', error: %s\", fname, err->message);\n+        g_warning(\"failed to read '%s', error: %s\", fname, err->message);\n         goto fail;\n     }\n \n     if (!g_utf8_validate(content, -1, NULL)) {\n-        slog(\"file is not utf-8 encoded: %s\", fname);\n+        g_warning(\"file is not utf-8 encoded: %s\", fname);\n         goto fail;\n     }\n     content2 = g_strdup_printf(\"%s%s\", group, content);\n \n     if (!g_key_file_load_from_data(keys, content2, -1, G_KEY_FILE_NONE,\n                                    &err)) {\n-        slog(\"failed to parse file '%s', error: %s\", fname, err->message);\n+        g_warning(\"failed to parse file '%s', error: %s\", fname, err->message);\n         goto fail;\n     }\n \ndiff --git a/qga/commands-win32.c b/qga/commands-win32.c\nindex c0bf3467bd..d26b0041ce 100644\n--- a/qga/commands-win32.c\n+++ b/qga/commands-win32.c\n@@ -231,7 +231,7 @@ int64_t qmp_guest_file_open(const char *path, const char *mode, Error **errp)\n     if (!mode) {\n         mode = \"r\";\n     }\n-    slog(\"guest-file-open called, filepath: %s, mode: %s\", path, mode);\n+    g_info(\"guest-file-open called, filepath: %s, mode: %s\", path, mode);\n     guest_flags = find_open_flag(mode);\n     if (guest_flags == NULL) {\n         error_setg(errp, \"invalid file open mode\");\n@@ -267,7 +267,7 @@ int64_t qmp_guest_file_open(const char *path, const char *mode, Error **errp)\n         goto done;\n     }\n \n-    slog(\"guest-file-open, handle: % \" PRId64, fd);\n+    g_info(\"guest-file-open, handle: % \" PRId64, fd);\n \n done:\n     g_free(w_path);\n@@ -278,7 +278,7 @@ void qmp_guest_file_close(int64_t handle, Error **errp)\n {\n     bool ret;\n     GuestFileHandle *gfh = guest_file_handle_find(handle, errp);\n-    slog(\"guest-file-close called, handle: %\" PRId64, handle);\n+    g_info(\"guest-file-close called, handle: %\" PRId64, handle);\n     if (gfh == NULL) {\n         return;\n     }\n@@ -337,7 +337,7 @@ void qmp_guest_shutdown(const char *mode, Error **errp)\n     Error *local_err = NULL;\n     UINT shutdown_flag = EWX_FORCE;\n \n-    slog(\"guest-shutdown called, mode: %s\", mode);\n+    g_info(\"guest-shutdown called, mode: %s\", mode);\n \n     if (!mode || strcmp(mode, \"powerdown\") == 0) {\n         shutdown_flag |= EWX_POWEROFF;\n@@ -361,7 +361,7 @@ void qmp_guest_shutdown(const char *mode, Error **errp)\n \n     if (!ExitWindowsEx(shutdown_flag, SHTDN_REASON_FLAG_PLANNED)) {\n         g_autofree gchar *emsg = g_win32_error_message(GetLastError());\n-        slog(\"guest-shutdown failed: %s\", emsg);\n+        g_warning(\"guest-shutdown failed: %s\", emsg);\n         error_setg_win32(errp, GetLastError(), \"guest-shutdown failed\");\n     }\n }\n@@ -426,7 +426,7 @@ GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64,\n     is_ok = WriteFile(fh, buf, count, &write_count, NULL);\n     if (!is_ok) {\n         error_setg_win32(errp, GetLastError(), \"failed to write to file\");\n-        slog(\"guest-file-write-failed, handle: %\" PRId64, handle);\n+        g_warning(\"guest-file-write failed, handle: %\" PRId64, handle);\n     } else {\n         write_data = g_new0(GuestFileWrite, 1);\n         write_data->count = (size_t) write_count;\n@@ -1255,7 +1255,7 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints,\n         return 0;\n     }\n \n-    slog(\"guest-fsfreeze called\");\n+    g_info(\"guest-fsfreeze called\");\n \n     /* cannot risk guest agent blocking itself on a write in this state */\n     ga_set_frozen(ga_state);\n@@ -1294,7 +1294,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **errp)\n \n     ga_unset_frozen(ga_state);\n \n-    slog(\"guest-fsthaw called\");\n+    g_info(\"guest-fsthaw called\");\n \n     return i;\n }\n@@ -1310,8 +1310,8 @@ static void guest_fsfreeze_cleanup(void)\n     if (ga_is_frozen(ga_state) == GUEST_FSFREEZE_STATUS_FROZEN) {\n         qmp_guest_fsfreeze_thaw(&err);\n         if (err) {\n-            slog(\"failed to clean up frozen filesystems: %s\",\n-                 error_get_pretty(err));\n+            g_warning(\"failed to clean up frozen filesystems: %s\",\n+                      error_get_pretty(err));\n             error_free(err);\n         }\n     }\n@@ -1464,7 +1464,7 @@ static DWORD WINAPI do_suspend(LPVOID opaque)\n \n     if (!SetSuspendState(*mode == GUEST_SUSPEND_MODE_DISK, TRUE, TRUE)) {\n         g_autofree gchar *emsg = g_win32_error_message(GetLastError());\n-        slog(\"failed to suspend guest: %s\", emsg);\n+        g_warning(\"failed to suspend guest: %s\", emsg);\n         ret = -1;\n     }\n     g_free(mode);\n@@ -2174,8 +2174,8 @@ static char *ga_get_win_name(const OSVERSIONINFOEXW *os_version, bool id)\n         }\n         ++table;\n     }\n-    slog(\"failed to lookup Windows version: major=%lu, minor=%lu\",\n-        major, minor);\n+    g_warning(\"failed to lookup Windows version: major=%lu, minor=%lu\",\n+              major, minor);\n     return g_strdup(\"N/A\");\n }\n \n@@ -2198,8 +2198,8 @@ static char *ga_get_win_product_name(Error **errp)\n     err = RegQueryValueExA(key, \"ProductName\", NULL, NULL,\n                             (LPBYTE)result, &size);\n     if (err == ERROR_MORE_DATA) {\n-        slog(\"ProductName longer than expected (%lu bytes), retrying\",\n-                size);\n+        g_info(\"ProductName longer than expected (%lu bytes), retrying\",\n+               size);\n         g_free(result);\n         result = NULL;\n         if (size > 0) {\n@@ -2244,8 +2244,8 @@ static char *ga_get_current_arch(void)\n         break;\n     case PROCESSOR_ARCHITECTURE_UNKNOWN:\n     default:\n-        slog(\"unknown processor architecture 0x%0x\",\n-            info.wProcessorArchitecture);\n+        g_warning(\"unknown processor architecture 0x%0x\",\n+                  info.wProcessorArchitecture);\n         result = g_strdup(\"unknown\");\n         break;\n     }\n@@ -2308,14 +2308,14 @@ static LPBYTE cm_get_property(DEVINST devInst, const DEVPROPKEY *propName,\n         buffer, &buffer_len, 0);\n     if (cr != CR_SUCCESS && cr != CR_BUFFER_SMALL) {\n \n-        slog(\"failed to get property size, error=0x%lx\", cr);\n+        g_warning(\"failed to get property size, error=0x%lx\", cr);\n         return NULL;\n     }\n     buffer = g_new0(BYTE, buffer_len + 1);\n     cr = CM_Get_DevNode_PropertyW(devInst, propName, propType,\n         buffer, &buffer_len, 0);\n     if (cr != CR_SUCCESS) {\n-        slog(\"failed to get device property, error=0x%lx\", cr);\n+        g_warning(\"failed to get device property, error=0x%lx\", cr);\n         return NULL;\n     }\n     return g_steal_pointer(&buffer);\n@@ -2329,7 +2329,7 @@ static GStrv ga_get_hardware_ids(DEVINST devInstance)\n     g_autofree LPWSTR property = (LPWSTR)cm_get_property(devInstance,\n         &qga_DEVPKEY_Device_HardwareIds, &cm_type);\n     if (property == NULL) {\n-        slog(\"failed to get hardware IDs\");\n+        g_warning(\"failed to get hardware IDs\");\n         return NULL;\n     }\n     if (*property == '\\0') {\n@@ -2371,7 +2371,7 @@ GuestDeviceInfoList *qmp_guest_get_devices(Error **errp)\n         return NULL;\n     }\n \n-    slog(\"enumerating devices\");\n+    g_info(\"enumerating devices\");\n     for (i = 0; SetupDiEnumDeviceInfo(dev_info, i, &dev_info_data); i++) {\n         bool skip = true;\n         g_autofree LPWSTR name = NULL;\n@@ -2385,7 +2385,7 @@ GuestDeviceInfoList *qmp_guest_get_devices(Error **errp)\n         name = (LPWSTR)cm_get_property(dev_info_data.DevInst,\n             &qga_DEVPKEY_NAME, &cm_type);\n         if (name == NULL) {\n-            slog(\"failed to get device description\");\n+            g_warning(\"failed to get device description\");\n             continue;\n         }\n         device->driver_name = g_utf16_to_utf8(name, -1, NULL, NULL, NULL);\n@@ -2393,7 +2393,7 @@ GuestDeviceInfoList *qmp_guest_get_devices(Error **errp)\n             error_setg(errp, \"conversion to utf8 failed (driver name)\");\n             return NULL;\n         }\n-        slog(\"querying device: %s\", device->driver_name);\n+        g_info(\"querying device: %s\", device->driver_name);\n         hw_ids = ga_get_hardware_ids(dev_info_data.DevInst);\n         if (hw_ids == NULL) {\n             continue;\n@@ -2424,7 +2424,7 @@ GuestDeviceInfoList *qmp_guest_get_devices(Error **errp)\n         version = (LPWSTR)cm_get_property(dev_info_data.DevInst,\n             &qga_DEVPKEY_Device_DriverVersion, &cm_type);\n         if (version == NULL) {\n-            slog(\"failed to get driver version\");\n+            g_warning(\"failed to get driver version\");\n             continue;\n         }\n         device->driver_version = g_utf16_to_utf8(version, -1, NULL,\n@@ -2437,15 +2437,15 @@ GuestDeviceInfoList *qmp_guest_get_devices(Error **errp)\n         date = (LPFILETIME)cm_get_property(dev_info_data.DevInst,\n             &qga_DEVPKEY_Device_DriverDate, &cm_type);\n         if (date == NULL) {\n-            slog(\"failed to get driver date\");\n+            g_warning(\"failed to get driver date\");\n             continue;\n         }\n         device->driver_date = filetime_to_ns(date);\n         device->has_driver_date = true;\n \n-        slog(\"driver: %s\\ndriver version: %\" PRId64 \",%s\\n\",\n-             device->driver_name, device->driver_date,\n-             device->driver_version);\n+        g_info(\"driver: %s\\ndriver version: %\" PRId64 \",%s\\n\",\n+               device->driver_name, device->driver_date,\n+               device->driver_version);\n         QAPI_LIST_APPEND(tail, g_steal_pointer(&device));\n     }\n \n@@ -2479,8 +2479,8 @@ static VOID CALLBACK load_avg_callback(PVOID hCounter, BOOLEAN timedOut)\n         (PDH_HCOUNTER)hCounter, PDH_FMT_DOUBLE, 0, &displayValue);\n     /* Skip updating the load if we can't get the value successfully */\n     if (err != ERROR_SUCCESS) {\n-        slog(\"PdhGetFormattedCounterValue failed to get load value with 0x%lx\",\n-             err);\n+        g_warning(\"PdhGetFormattedCounterValue failed to get load value\"\n+                  \" with 0x%lx\", err);\n         return;\n     }\n     currentLoad = displayValue.doubleValue;\ndiff --git a/qga/commands.c b/qga/commands.c\nindex 5f20af25d3..55edd9fd4c 100644\n--- a/qga/commands.c\n+++ b/qga/commands.c\n@@ -30,19 +30,6 @@\n  */\n #define GUEST_FILE_READ_COUNT_MAX (48 * MiB)\n \n-/* Note: in some situations, like with the fsfreeze, logging may be\n- * temporarily disabled. if it is necessary that a command be able\n- * to log for accounting purposes, check ga_logging_enabled() beforehand.\n- */\n-void slog(const gchar *fmt, ...)\n-{\n-    va_list ap;\n-\n-    va_start(ap, fmt);\n-    g_logv(\"syslog\", G_LOG_LEVEL_INFO, fmt, ap);\n-    va_end(ap);\n-}\n-\n int64_t qmp_guest_sync_delimited(int64_t id, Error **errp)\n {\n     ga_set_response_delimited(ga_state);\n@@ -56,7 +43,7 @@ int64_t qmp_guest_sync(int64_t id, Error **errp)\n \n void qmp_guest_ping(Error **errp)\n {\n-    slog(\"guest-ping called\");\n+    g_info(\"guest-ping called\");\n }\n \n static void qmp_command_info(const QmpCommand *cmd, void *opaque)\n@@ -149,7 +136,7 @@ GuestExecStatus *qmp_guest_exec_status(int64_t pid, Error **errp)\n     GuestExecInfo *gei;\n     GuestExecStatus *ges;\n \n-    slog(\"guest-exec-status called, pid: %u\", (uint32_t)pid);\n+    g_info(\"guest-exec-status called, pid: %u\", (uint32_t)pid);\n \n     gei = guest_exec_info_find(pid);\n     if (gei == NULL) {\n@@ -251,7 +238,7 @@ static char **guest_exec_get_args(const strList *entry, bool log)\n     args[i] = NULL;\n \n     if (log) {\n-        slog(\"guest-exec called: \\\"%s\\\"\", str);\n+        g_info(\"guest-exec called: \\\"%s\\\"\", str);\n     }\n     g_free(str);\n \n@@ -285,8 +272,8 @@ static void guest_exec_task_setup(gpointer data)\n          * inside the parent, not the child.\n          */\n         if (dup2(STDOUT_FILENO, STDERR_FILENO) != 0) {\n-            slog(\"dup2() failed to merge stderr into stdout: %s\",\n-                 strerror(errno));\n+            g_warning(\"dup2() failed to merge stderr into stdout: %s\",\n+                      strerror(errno));\n         }\n     }\n \n@@ -295,8 +282,8 @@ static void guest_exec_task_setup(gpointer data)\n     sigact.sa_handler = SIG_DFL;\n \n     if (sigaction(SIGPIPE, &sigact, NULL) != 0) {\n-        slog(\"sigaction() failed to reset child process's SIGPIPE: %s\",\n-             strerror(errno));\n+        g_warning(\"sigaction() failed to reset child process's SIGPIPE: %s\",\n+                  strerror(errno));\n     }\n #endif\n }\n@@ -626,7 +613,7 @@ GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count,\n \n     read_data = guest_file_read_unsafe(gfh, count, errp);\n     if (!read_data) {\n-        slog(\"guest-file-write failed, handle: %\" PRId64, handle);\n+        g_warning(\"guest-file-read failed, handle: %\" PRId64, handle);\n     }\n \n     return read_data;\ndiff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h\nindex d9f3922adf..0f2d1b3415 100644\n--- a/qga/guest-agent-core.h\n+++ b/qga/guest-agent-core.h\n@@ -40,7 +40,6 @@ void ga_command_state_free(GACommandState *cs);\n bool ga_logging_enabled(GAState *s);\n void ga_disable_logging(GAState *s);\n void ga_enable_logging(GAState *s);\n-void G_GNUC_PRINTF(1, 2) slog(const gchar *fmt, ...);\n void ga_set_response_delimited(GAState *s);\n bool ga_is_frozen(GAState *s);\n void ga_set_frozen(GAState *s);\ndiff --git a/qga/main.c b/qga/main.c\nindex fd19c7037d..40b92ec686 100644\n--- a/qga/main.c\n+++ b/qga/main.c\n@@ -286,7 +286,8 @@ QEMU_COPYRIGHT \"\\n\"\n #endif\n \"  -t, --statedir    specify dir to store state information (absolute paths\\n\"\n \"                    only, default is %s)\\n\"\n-\"  -v, --verbose     log extra debugging information\\n\"\n+\"  -v, --verbose     enable verbose logging (info and above)\\n\"\n+\"  --debug           enable debug logging (all messages)\\n\"\n \"  -V, --version     print version information and exit\\n\"\n \"  -d, --daemonize   become a daemon\\n\"\n #ifdef _WIN32\n@@ -391,18 +392,24 @@ static void ga_log(const gchar *domain, GLogLevelFlags level,\n     }\n \n     level &= G_LOG_LEVEL_MASK;\n-    if (g_strcmp0(domain, \"syslog\") == 0) {\n+    if (!(level & s->log_level)) {\n+        return;\n+    }\n+\n+    if (s->log_file) {\n+        g_autoptr(GDateTime) now = g_date_time_new_now_utc();\n+        g_autofree char *nowstr = g_date_time_format(now, \"%s.%f\");\n+        fprintf(s->log_file, \"%s: %s: %s\\n\", nowstr, level_str, msg);\n+        fflush(s->log_file);\n+    }\n+\n+    if (level & ~G_LOG_LEVEL_DEBUG) {\n #ifndef _WIN32\n         syslog(glib_log_level_to_system(level), \"%s: %s\", level_str, msg);\n #else\n         ReportEvent(s->event_log, glib_log_level_to_system(level),\n                     0, 1, NULL, 1, 0, &msg, NULL);\n #endif\n-    } else if (level & s->log_level) {\n-        g_autoptr(GDateTime) now = g_date_time_new_now_utc();\n-        g_autofree char *nowstr = g_date_time_format(now, \"%s.%f\");\n-        fprintf(s->log_file, \"%s: %s: %s\\n\", nowstr, level_str, msg);\n-        fflush(s->log_file);\n     }\n }\n \n@@ -1140,7 +1147,10 @@ static void config_load(GAConfig *config, const char *confpath, bool required)\n     }\n     if (g_key_file_has_key(keyfile, \"general\", \"verbose\", NULL) &&\n         g_key_file_get_boolean(keyfile, \"general\", \"verbose\", &gerr)) {\n-        /* enable all log levels */\n+        config->log_level |= G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO;\n+    }\n+    if (g_key_file_has_key(keyfile, \"general\", \"debug\", NULL) &&\n+        g_key_file_get_boolean(keyfile, \"general\", \"debug\", &gerr)) {\n         config->log_level = G_LOG_LEVEL_MASK;\n     }\n     if (g_key_file_has_key(keyfile, \"general\", \"retry-path\", NULL)) {\n@@ -1214,7 +1224,9 @@ static void config_dump(GAConfig *config)\n #endif\n     g_key_file_set_string(keyfile, \"general\", \"statedir\", config->state_dir);\n     g_key_file_set_boolean(keyfile, \"general\", \"verbose\",\n-                           config->log_level == G_LOG_LEVEL_MASK);\n+                           config->log_level & G_LOG_LEVEL_INFO);\n+    g_key_file_set_boolean(keyfile, \"general\", \"debug\",\n+                           config->log_level & G_LOG_LEVEL_DEBUG);\n     g_key_file_set_boolean(keyfile, \"general\", \"retry-path\",\n                            config->retry_path);\n     tmp = list_join(config->blockedrpcs, ',');\n@@ -1238,6 +1250,7 @@ static void config_dump(GAConfig *config)\n \n static void config_parse(GAConfig *config, int argc, char **argv)\n {\n+    enum { OPT_DEBUG = 256 };\n     const char *sopt = \"hVvdc:m:p:l:f:F::b:a:s:t:Dr\";\n     int opt_ind = 0, ch;\n     const struct option lopt[] = {\n@@ -1251,6 +1264,7 @@ static void config_parse(GAConfig *config, int argc, char **argv)\n         { \"fsfreeze-hook\", 2, NULL, 'F' },\n #endif\n         { \"verbose\", 0, NULL, 'v' },\n+        { \"debug\", 0, NULL, OPT_DEBUG },\n         { \"method\", 1, NULL, 'm' },\n         { \"path\", 1, NULL, 'p' },\n         { \"daemonize\", 0, NULL, 'd' },\n@@ -1313,7 +1327,9 @@ static void config_parse(GAConfig *config, int argc, char **argv)\n             config->state_dir = g_strdup(optarg);\n             break;\n         case 'v':\n-            /* enable all log levels */\n+            config->log_level |= G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO;\n+            break;\n+        case OPT_DEBUG:\n             config->log_level = G_LOG_LEVEL_MASK;\n             break;\n         case 'V':\n@@ -1673,7 +1689,8 @@ int main(int argc, char **argv)\n     GAConfig *config = g_new0(GAConfig, 1);\n     int socket_activation;\n \n-    config->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL;\n+    config->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL\n+                      | G_LOG_LEVEL_WARNING;\n \n     qemu_init_exec_dir(argv[0]);\n     qga_qmp_init_marshal(&ga_commands);\n","prefixes":["v3","1/2"]}