Index: trunk/src/VBox/HostDrivers/Support/SUPDrv.c
===================================================================
--- trunk/src/VBox/HostDrivers/Support/SUPDrv.c	(revision 18182)
+++ trunk/src/VBox/HostDrivers/Support/SUPDrv.c	(revision 18191)
@@ -136,4 +136,5 @@
 static void     supdrvLdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage);
 static int      supdrvIOCtl_CallServiceModule(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPCALLSERVICE pReq);
+static int      supdrvIOCtl_LoggerSettings(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLOGGERSETTINGS pReq);
 static SUPGIPMODE supdrvGipDeterminTscMode(PSUPDRVDEVEXT pDevExt);
 #ifdef RT_OS_WINDOWS
@@ -1514,4 +1515,26 @@
         }
 
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LOGGER_SETTINGS(0)):
+        {
+            /* validate */
+            PSUPLOGGERSETTINGS pReq = (PSUPLOGGERSETTINGS)pReqHdr;
+            uint32_t cbStrTab;
+            REQ_CHECK_SIZE_OUT(SUP_IOCTL_LOGGER_SETTINGS, SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT);
+            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->Hdr.cbIn >= SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(1));
+            cbStrTab = pReq->Hdr.cbIn - SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(0);
+            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.offGroups      < cbStrTab);
+            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.offFlags       < cbStrTab);
+            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.offDestination < cbStrTab);
+            REQ_CHECK_EXPR_FMT(pReq->u.In.szStrings[cbStrTab - 1] == '\0',
+                               ("SUP_IOCTL_LOGGER_SETTINGS: cbIn=%#x cbStrTab=%#x LastChar=%d\n",
+                                pReq->Hdr.cbIn, cbStrTab, pReq->u.In.szStrings[cbStrTab - 1]));
+            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.fWhich <= SUPLOGGERSETTINGS_WHICH_RELEASE);
+            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.fWhat  <= SUPLOGGERSETTINGS_WHAT_DESTROY);
+
+            /* execute */
+            pReq->Hdr.rc = supdrvIOCtl_LoggerSettings(pDevExt, pSession, pReq);
+            return 0;
+        }
+
         default:
             Log(("Unknown IOCTL %#lx\n", (long)uIOCtl));
@@ -4035,4 +4058,138 @@
 
 /**
+ * Implements the logger settings request.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt     The device extension.
+ * @param   pSession    The caller's session.
+ * @param   pReq        The request.
+ */
+static int supdrvIOCtl_LoggerSettings(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLOGGERSETTINGS pReq)
+{
+    const char *pszGroup = &pReq->u.In.szStrings[pReq->u.In.offGroups];
+    const char *pszFlags = &pReq->u.In.szStrings[pReq->u.In.offFlags];
+    const char *pszDest  = &pReq->u.In.szStrings[pReq->u.In.offDestination];
+    PRTLOGGER   pLogger  = NULL;
+    int         rc;
+
+    /*
+     * Some further validation.
+     */
+    switch (pReq->u.In.fWhat)
+    {
+        case SUPLOGGERSETTINGS_WHAT_SETTINGS:
+        case SUPLOGGERSETTINGS_WHAT_CREATE:
+            break;
+
+        case SUPLOGGERSETTINGS_WHAT_DESTROY:
+            if (*pszGroup || *pszFlags || *pszDest)
+                return VERR_INVALID_PARAMETER;
+            if (pReq->u.In.fWhich == SUPLOGGERSETTINGS_WHICH_RELEASE)
+                return VERR_ACCESS_DENIED;
+            break;
+
+        default:
+            return VERR_INTERNAL_ERROR;
+    }
+
+    /*
+     * Get the logger.
+     */
+    switch (pReq->u.In.fWhich)
+    {
+        case SUPLOGGERSETTINGS_WHICH_DEBUG:
+            pLogger = RTLogGetDefaultInstance();
+            break;
+
+        case SUPLOGGERSETTINGS_WHICH_RELEASE:
+            pLogger = RTLogRelDefaultInstance();
+            break;
+
+        default:
+            return VERR_INTERNAL_ERROR;
+    }
+
+    /*
+     * Do the job.
+     */
+    switch (pReq->u.In.fWhat)
+    {
+        case SUPLOGGERSETTINGS_WHAT_SETTINGS:
+            if (pLogger)
+            {
+                rc = RTLogFlags(pLogger, pszFlags);
+                if (RT_SUCCESS(rc))
+                    rc = RTLogGroupSettings(pLogger, pszGroup);
+                NOREF(pszDest);
+            }
+            else
+                rc = VERR_NOT_FOUND;
+            break;
+
+        case SUPLOGGERSETTINGS_WHAT_CREATE:
+        {
+            if (pLogger)
+                rc = VERR_ALREADY_EXISTS;
+            else
+            {
+                static const char * const s_apszGroups[] = VBOX_LOGGROUP_NAMES;
+
+                rc = RTLogCreate(&pLogger,
+                                 0 /* fFlags */,
+                                 pszGroup,
+                                 pReq->u.In.fWhich == SUPLOGGERSETTINGS_WHICH_DEBUG
+                                 ? "VBOX_LOG"
+                                 : "VBOX_RELEASE_LOG",
+                                 RT_ELEMENTS(s_apszGroups),
+                                 s_apszGroups,
+                                 RTLOGDEST_STDOUT | RTLOGDEST_DEBUGGER,
+                                 NULL);
+                if (RT_SUCCESS(rc))
+                {
+                    rc = RTLogFlags(pLogger, pszFlags);
+                    NOREF(pszDest);
+                    if (RT_SUCCESS(rc))
+                    {
+                        switch (pReq->u.In.fWhich)
+                        {
+                            case SUPLOGGERSETTINGS_WHICH_DEBUG:
+                                pLogger = RTLogSetDefaultInstance(pLogger);
+                                break;
+                            case SUPLOGGERSETTINGS_WHICH_RELEASE:
+                                pLogger = RTLogRelSetDefaultInstance(pLogger);
+                                break;
+                        }
+                    }
+                    RTLogDestroy(pLogger);
+                }
+            }
+            break;
+        }
+
+        case SUPLOGGERSETTINGS_WHAT_DESTROY:
+            switch (pReq->u.In.fWhich)
+            {
+                case SUPLOGGERSETTINGS_WHICH_DEBUG:
+                    pLogger = RTLogSetDefaultInstance(NULL);
+                    break;
+                case SUPLOGGERSETTINGS_WHICH_RELEASE:
+                    pLogger = RTLogRelSetDefaultInstance(NULL);
+                    break;
+            }
+            rc = RTLogDestroy(pLogger);
+            break;
+
+        default:
+        {
+            rc = VERR_INTERNAL_ERROR;
+            break;
+        }
+    }
+
+    return rc;
+}
+
+
+/**
  * Gets the paging mode of the current CPU.
  *
Index: trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h
===================================================================
--- trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h	(revision 18182)
+++ trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h	(revision 18191)
@@ -904,8 +904,8 @@
  * @{
  */
-#define SUP_IOCTL_PAGE_ALLOC_EX                     SUP_CTL_CODE_BIG(23)
-#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages)        RT_UOFFSETOF(SUPPAGEALLOCEX, u.Out.aPages[cPages])
-#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN             (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOCEX, u.In))
-#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_OUT(cPages)    SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages)
+#define SUP_IOCTL_PAGE_ALLOC_EX                         SUP_CTL_CODE_BIG(23)
+#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages)            RT_UOFFSETOF(SUPPAGEALLOCEX, u.Out.aPages[cPages])
+#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN                 (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOCEX, u.In))
+#define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_OUT(cPages)        SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages)
 typedef struct SUPPAGEALLOCEX
 {
@@ -952,8 +952,8 @@
  * @{
  */
-#define SUP_IOCTL_PAGE_MAP_KERNEL                     SUP_CTL_CODE_SIZE(24, SUP_IOCTL_PAGE_MAP_KERNEL_SIZE)
-#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE                sizeof(SUPPAGEMAPKERNEL)
-#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_IN             sizeof(SUPPAGEMAPKERNEL)
-#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_OUT            sizeof(SUPPAGEMAPKERNEL)
+#define SUP_IOCTL_PAGE_MAP_KERNEL                       SUP_CTL_CODE_SIZE(24, SUP_IOCTL_PAGE_MAP_KERNEL_SIZE)
+#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE                  sizeof(SUPPAGEMAPKERNEL)
+#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_IN               sizeof(SUPPAGEMAPKERNEL)
+#define SUP_IOCTL_PAGE_MAP_KERNEL_SIZE_OUT              sizeof(SUPPAGEMAPKERNEL)
 typedef struct SUPPAGEMAPKERNEL
 {
@@ -983,4 +983,51 @@
 
 
+/** @name SUP_IOCTL_LOGGER_SETTINGS
+ * Changes the ring-0 release or debug logger settings.
+ * @{
+ */
+#define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab)             SUP_CTL_CODE_SIZE(25, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab))
+#define SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab)        RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
+#define SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab)     RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
+#define SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT              sizeof(SUPREQHDR)
+typedef struct SUPLOGGERSETTINGS
+{
+    /** The header. */
+    SUPREQHDR               Hdr;
+    union
+    {
+        struct
+        {
+            /** Which logger. */
+            uint32_t        fWhich;
+            /** What to do with it. */
+            uint32_t        fWhat;
+            /** Offset of the flags setting string. */
+            uint32_t        offFlags;
+            /** Offset of the groups setting string. */
+            uint32_t        offGroups;
+            /** Offset of the destination setting string. */
+            uint32_t        offDestination;
+            /** The string table. */
+            char            szStrings[1];
+        } In;
+    } u;
+} SUPLOGGERSETTINGS, *PSUPLOGGERSETTINGS;
+
+/** Debug logger. */
+#define SUPLOGGERSETTINGS_WHICH_DEBUG       0
+/** Release logger. */
+#define SUPLOGGERSETTINGS_WHICH_RELEASE     1
+
+/** Change the settings. */
+#define SUPLOGGERSETTINGS_WHAT_SETTINGS     0
+/** Create the logger instance. */
+#define SUPLOGGERSETTINGS_WHAT_CREATE       1
+/** Destroy the logger instance. */
+#define SUPLOGGERSETTINGS_WHAT_DESTROY      2
+
+/** @} */
+
+
 #pragma pack()                          /* paranoia */
 
Index: trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
===================================================================
--- trunk/src/VBox/HostDrivers/Support/SUPLib.cpp	(revision 18182)
+++ trunk/src/VBox/HostDrivers/Support/SUPLib.cpp	(revision 18191)
@@ -734,4 +734,102 @@
 
 
+/**
+ * Worker for the SUPR3Logger* APIs.
+ *
+ * @returns VBox status code.
+ * @param   enmWhich    Which logger.
+ * @param   fWhat       What to do with the logger.
+ * @param   pszFlags    The flags settings.
+ * @param   pszGroups   The groups settings.
+ * @param   pszDest     The destionation specificier.
+ */
+static int supR3LoggerSettings(SUPLOGGER enmWhich, uint32_t fWhat, const char *pszFlags, const char *pszGroups, const char *pszDest)
+{
+    size_t const cchFlags  = pszFlags  ? strlen(pszFlags)  : 0;
+    size_t const cchGroups = pszGroups ? strlen(pszGroups) : 0;
+    size_t const cchDest   = pszDest   ? strlen(pszDest)   : 0;
+    size_t const cbStrTab  = cchFlags  + !!cchFlags
+                           + cchGroups + !!cchGroups
+                           + cchDest   + !!cchDest
+                           + (!cchFlags && !cchGroups && !cchDest);
+
+    PSUPLOGGERSETTINGS pReq  = (PSUPLOGGERSETTINGS)alloca(SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab));
+    pReq->Hdr.u32Cookie = g_u32Cookie;
+    pReq->Hdr.u32SessionCookie = g_u32SessionCookie;
+    pReq->Hdr.cbIn  = SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab);
+    pReq->Hdr.cbOut = SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT;
+    pReq->Hdr.fFlags= SUPREQHDR_FLAGS_DEFAULT;
+    pReq->Hdr.rc    = VERR_INTERNAL_ERROR;
+    switch (enmWhich)
+    {
+        case SUPLOGGER_DEBUG:   pReq->u.In.fWhich = SUPLOGGERSETTINGS_WHICH_DEBUG; break;
+        case SUPLOGGER_RELEASE: pReq->u.In.fWhich = SUPLOGGERSETTINGS_WHICH_RELEASE; break;
+        default:
+            return VERR_INVALID_PARAMETER;
+    }
+    pReq->u.In.fWhat = fWhat;
+
+    uint32_t off = 0;
+    if (cchFlags)
+    {
+        pReq->u.In.offFlags = off;
+        memcpy(&pReq->u.In.szStrings[off], pszFlags, cchFlags + 1);
+        off += cchFlags + 1;
+    }
+    else
+        pReq->u.In.offFlags = cbStrTab - 1;
+
+    if (cchGroups)
+    {
+        pReq->u.In.offGroups = off;
+        memcpy(&pReq->u.In.szStrings[off], pszGroups, cchGroups + 1);
+        off += cchGroups + 1;
+    }
+    else
+        pReq->u.In.offGroups = cbStrTab - 1;
+
+    if (cchDest)
+    {
+        pReq->u.In.offDestination = off;
+        memcpy(&pReq->u.In.szStrings[off], pszDest, cchDest + 1);
+        off += cchDest + 1;
+    }
+    else
+        pReq->u.In.offDestination = cbStrTab - 1;
+
+    if (!off)
+    {
+        pReq->u.In.szStrings[0] = '\0';
+        off++;
+    }
+    Assert(off == cbStrTab);
+    Assert(pReq->u.In.szStrings[cbStrTab - 1] == '\0');
+
+
+    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_LOGGER_SETTINGS(cbStrTab), pReq, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab));
+    if (RT_SUCCESS(rc))
+        rc = pReq->Hdr.rc;
+    return rc;
+}
+
+
+SUPR3DECL(int) SUPR3LoggerSettings(SUPLOGGER enmWhich, const char *pszFlags, const char *pszGroups, const char *pszDest)
+{
+    return supR3LoggerSettings(enmWhich, SUPLOGGERSETTINGS_WHAT_SETTINGS, pszFlags, pszGroups, pszDest);
+}
+
+
+SUPR3DECL(int) SUPR3LoggerCreate(SUPLOGGER enmWhich, const char *pszFlags, const char *pszGroups, const char *pszDest)
+{
+    return supR3LoggerSettings(enmWhich, SUPLOGGERSETTINGS_WHAT_CREATE, pszFlags, pszGroups, pszDest);
+}
+
+
+SUPR3DECL(int) SUPR3LoggerDestroy(SUPLOGGER enmWhich)
+{
+    return supR3LoggerSettings(enmWhich, SUPLOGGERSETTINGS_WHAT_DESTROY, NULL, NULL, NULL);
+}
+
+
 SUPR3DECL(int) SUPPageAlloc(size_t cPages, void **ppvPages)
 {
Index: trunk/src/VBox/HostDrivers/Support/testcase/Makefile.kmk
===================================================================
--- trunk/src/VBox/HostDrivers/Support/testcase/Makefile.kmk	(revision 18182)
+++ trunk/src/VBox/HostDrivers/Support/testcase/Makefile.kmk	(revision 18191)
@@ -34,5 +34,6 @@
 PROGRAMS += \
 	SUPInstall \
-	SUPUninstall
+	SUPUninstall \
+	SUPLoggerCtl
 ifdef VBOX_WITH_TESTCASES
 PROGRAMS += \
@@ -54,4 +55,8 @@
 SUPUninstall_SOURCES  = SUPUninstall.cpp
 SUPUninstall_LIBS     = $(LIB_RUNTIME)
+
+SUPLoggerCtl_TEMPLATE = VBOXR3EXE
+SUPLoggerCtl_SOURCES  = SUPLoggerCtl.cpp
+SUPLoggerCtl_LIBS     = $(LIB_RUNTIME)
 
 tstInt_TEMPLATE       = VBOXR3EXE
Index: trunk/src/VBox/HostDrivers/Support/testcase/SUPLoggerCtl.cpp
===================================================================
--- trunk/src/VBox/HostDrivers/Support/testcase/SUPLoggerCtl.cpp	(revision 18191)
+++ trunk/src/VBox/HostDrivers/Support/testcase/SUPLoggerCtl.cpp	(revision 18191)
@@ -0,0 +1,184 @@
+/* $Id$ */
+/** @file
+ * SUPLoggerCtl - Support Driver Logger Control.
+ */
+
+/*
+ * Copyright (C) 2009 Sun Microsystems, Inc.
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, CA 95054 USA or visit http://www.sun.com if you need
+ * additional information or have any questions.
+ *
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <VBox/sup.h>
+#include <iprt/initterm.h>
+#include <iprt/getopt.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+#include <iprt/ctype.h>
+#include <iprt/err.h>
+
+
+/**
+ * Prints the usage.
+ * @returns 1.
+ */
+static int usage(void)
+{
+    RTPrintf("usage: SUPLoggerCtl [-f|--flags <flags-settings>] \\\n"
+             "                    [-g|--groups <groups-settings>] \\\n"
+             "                    [-d|--dest <destination-specifiers>] \\\n"
+             "                    [-l|--which <release|debug>] \\\n"
+             "                    [-o|--what <set|create|destroy>]\n"
+             "   or: SUPLoggerCtl <-h|--help>\n"
+             "\n"
+             );
+    return 1;
+}
+
+
+int main(int argc, char **argv)
+{
+    RTR3InitAndSUPLib();
+
+    /*
+     * Options are mandatory.
+     */
+    if (argc <= 1)
+        return usage();
+
+    /*
+     * Parse the options.
+     */
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        { "--flags",    'f', RTGETOPT_REQ_STRING },
+        { "--groups",   'g', RTGETOPT_REQ_STRING },
+        { "--dest",     'd', RTGETOPT_REQ_STRING },
+        { "--what",     'o', RTGETOPT_REQ_STRING },
+        { "--which",    'l', RTGETOPT_REQ_STRING },
+        { "--help",     'h', 0 },
+    };
+
+    const char *pszFlags  = "";
+    const char *pszGroups = "";
+    const char *pszDest   = "";
+    SUPLOGGER   enmWhich  = SUPLOGGER_DEBUG;
+    enum
+    {
+        kSupLoggerCtl_Set, kSupLoggerCtl_Create, kSupLoggerCtl_Destroy
+    }           enmWhat   = kSupLoggerCtl_Set;
+
+    int ch;
+    int i = 1;
+    RTGETOPTUNION Val;
+    RTGETOPTSTATE GetState;
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 0);
+    while ((ch = RTGetOpt(&GetState, &Val)))
+    {
+        switch (ch)
+        {
+            case 'f':
+                pszFlags = Val.psz;
+                break;
+
+            case 'g':
+                pszGroups = Val.psz;
+                break;
+
+            case 'd':
+                pszDest = Val.psz;
+                break;
+
+            case 'o':
+                if (!strcmp(Val.psz, "set"))
+                    enmWhat = kSupLoggerCtl_Set;
+                else if (!strcmp(Val.psz, "create"))
+                    enmWhat = kSupLoggerCtl_Create;
+                else if (!strcmp(Val.psz, "destroy"))
+                    enmWhat = kSupLoggerCtl_Destroy;
+                else
+                {
+                    RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: Unknown operation '%s'.\n", Val.psz);
+                    return 1;
+                }
+                break;
+
+            case 'l':
+                if (!strcmp(Val.psz, "debug"))
+                    enmWhich = SUPLOGGER_DEBUG;
+                else if (!strcmp(Val.psz, "release"))
+                    enmWhich = SUPLOGGER_RELEASE;
+                else
+                {
+                    RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: Unknown logger '%s'.\n", Val.psz);
+                    return 1;
+                }
+                break;
+
+            case 'h':
+                return usage();
+
+            case VINF_GETOPT_NOT_OPTION:
+                RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: Unexpected argument '%s'.\n", Val.psz);
+                return 1;
+
+            default:
+                if (ch > 0)
+                {
+                    if (RT_C_IS_GRAPH(ch))
+                        RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: unhandled option: -%c\n", ch);
+                    else
+                        RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: unhandled option: %i\n", ch);
+                }
+                else if (ch == VERR_GETOPT_UNKNOWN_OPTION)
+                    RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: unknown option: %s\n", Val.psz);
+                else if (Val.pDef)
+                    RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: %s: %Rrs\n", Val.pDef->pszLong, ch);
+                else
+                    RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: %Rrs\n", ch);
+                return 1;
+        }
+    }
+
+    /*
+     * Do the requested job.
+     */
+    int rc;
+    switch (enmWhat)
+    {
+        case kSupLoggerCtl_Set:
+            rc = SUPR3LoggerSettings(enmWhich, pszFlags, pszGroups, pszDest);
+            break;
+        case kSupLoggerCtl_Create:
+            rc = SUPR3LoggerCreate(enmWhich, pszFlags, pszGroups, pszDest);
+            break;
+        case kSupLoggerCtl_Destroy:
+            rc = SUPR3LoggerDestroy(enmWhich);
+            break;
+        default:
+            rc = VERR_INTERNAL_ERROR;
+            break;
+    }
+    if (RT_SUCCESS(rc))
+        RTPrintf("SUPLoggerCtl: Success\n");
+    else
+        RTStrmPrintf(g_pStdErr, "SUPLoggerCtl: error: rc=%Rrc\n", rc);
+
+    return RT_SUCCESS(rc) ? 0 : 1;
+}
+
+
