Index: /trunk/include/VBox/com/ptr.h
===================================================================
--- /trunk/include/VBox/com/ptr.h	(revision 22707)
+++ /trunk/include/VBox/com/ptr.h	(revision 22708)
@@ -67,7 +67,8 @@
 #include <VBox/com/assert.h>
 
+#define LOGREF(prefix, pObj, cRefs) com::LogRef("%s {%p} cRefs=%d\n", (prefix), (pObj), (cRefs))
+
 namespace com
 {
-    #define LOGREF(prefix, pObj, cRefs) com::LogRef(#pObj "{%p}.refCnt=%d\n", (pObj), (cRefs));
     void LogRef(const char *pcszFormat, ...);
 }
@@ -83,12 +84,11 @@
     static void addref(C *p)
     {
-        size_t cRefs = p->AddRef();
+        int cRefs = p->AddRef();
         LOGREF("ADDREF ", p, cRefs);
     }
     static void release(C *p)
     {
-        size_t cRefs = p->Release();
-        LOGREF("RELEASE ", p, cRefs);
-        p->Release();
+        int cRefs = p->Release();
+        LOGREF("RELEASE", p, cRefs);
     }
 };
@@ -102,6 +102,6 @@
 protected:
 
-    static void addref  (C * /* p */) {}
-    static void release (C * /* p */) {}
+    static void addref(C * /* p */) {}
+    static void release(C * /* p */) {}
 };
 
@@ -120,12 +120,12 @@
  */
 template <class I1, class I2>
-inline bool ComPtrEquals (I1 *aThis, I2 *aThat)
+inline bool ComPtrEquals(I1 *aThis, I2 *aThat)
 {
     IUnknown *thatUnk = NULL, *thisUnk = NULL;
     if (aThat)
-        aThat->QueryInterface (COM_IIDOF (IUnknown), (void **) &thatUnk);
+        aThat->QueryInterface(COM_IIDOF(IUnknown), (void**)&thatUnk);
     if (aThis)
-        aThis->QueryInterface (COM_IIDOF (IUnknown), (void **) &thisUnk);
-    bool equal = thisUnk == thatUnk;
+        aThis->QueryInterface(COM_IIDOF(IUnknown), (void**)&thisUnk);
+    bool equal = (thisUnk == thatUnk);
     if (thisUnk)
         thisUnk->Release();
@@ -137,10 +137,10 @@
 /* specialization for <Any, IUnknown> */
 template <class I1>
-inline bool ComPtrEquals (I1 *aThis, IUnknown *aThat)
+inline bool ComPtrEquals(I1 *aThis, IUnknown *aThat)
 {
     IUnknown *thisUnk = NULL;
     if (aThis)
-        aThis->QueryInterface (COM_IIDOF (IUnknown), (void **) &thisUnk);
-    bool equal = thisUnk == aThat;
+        aThis->QueryInterface(COM_IIDOF(IUnknown), (void**)&thisUnk);
+    bool equal = (thisUnk == aThat);
     if (thisUnk)
         thisUnk->Release();
@@ -150,10 +150,10 @@
 /** Specialization for <IUnknown, Any> */
 template <class I2>
-inline bool ComPtrEquals (IUnknown *aThis, I2 *aThat)
+inline bool ComPtrEquals(IUnknown *aThis, I2 *aThat)
 {
     IUnknown *thatUnk = NULL;
     if (aThat)
-        aThat->QueryInterface (COM_IIDOF (IUnknown), (void **) &thatUnk);
-    bool equal = aThis == thatUnk;
+        aThat->QueryInterface(COM_IIDOF(IUnknown), (void**)&thatUnk);
+    bool equal = (aThis == thatUnk);
     if (thatUnk)
         thatUnk->Release();
@@ -163,5 +163,5 @@
 /* specialization for IUnknown */
 template<>
-inline bool ComPtrEquals <IUnknown, IUnknown> (IUnknown *aThis, IUnknown *aThat)
+inline bool ComPtrEquals<IUnknown, IUnknown>(IUnknown *aThis, IUnknown *aThat)
 {
     return aThis == aThat;
Index: /trunk/include/VBox/log.h
===================================================================
--- /trunk/include/VBox/log.h	(revision 22707)
+++ /trunk/include/VBox/log.h	(revision 22708)
@@ -325,5 +325,7 @@
     LOG_GROUP_VMM,
     /** VRDP group */
-    LOG_GROUP_VRDP
+    LOG_GROUP_VRDP,
+    /** Webservice group. */
+    LOG_GROUP_WEBSERVICE
     /* !!!ALPHABETICALLY!!! */
 } VBOX_LOGGROUP;
@@ -478,4 +480,5 @@
     "VMM",          \
     "VRDP",         \
+    "WEBSERVICE",   \
 }
 
Index: /trunk/src/VBox/Main/glue/com.cpp
===================================================================
--- /trunk/src/VBox/Main/glue/com.cpp	(revision 22707)
+++ /trunk/src/VBox/Main/glue/com.cpp	(revision 22708)
@@ -51,6 +51,4 @@
 #include <VBox/err.h>
 
-#include <Logging.h>
-
 #ifdef RT_OS_DARWIN
 #define VBOX_USER_HOME_SUFFIX   "Library/VirtualBox"
@@ -59,4 +57,5 @@
 #endif
 
+#include "Logging.h"
 
 namespace com
Index: /trunk/src/VBox/Main/webservice/vboxweb.cpp
===================================================================
--- /trunk/src/VBox/Main/webservice/vboxweb.cpp	(revision 22707)
+++ /trunk/src/VBox/Main/webservice/vboxweb.cpp	(revision 22708)
@@ -21,16 +21,14 @@
  */
 
+// shared webservice header
+#include "vboxweb.h"
+
 // vbox headers
 #include <VBox/com/com.h>
-#include <VBox/com/string.h>
-#include <VBox/com/Guid.h>
 #include <VBox/com/ErrorInfo.h>
 #include <VBox/com/errorprint.h>
 #include <VBox/com/EventQueue.h>
-#include <VBox/com/VirtualBox.h>
-#include <VBox/err.h>
 #include <VBox/VRDPAuth.h>
 #include <VBox/version.h>
-#include <VBox/log.h>
 
 #include <iprt/lock.h>
@@ -40,5 +38,4 @@
 #include <iprt/ctype.h>
 #include <iprt/process.h>
-#include <iprt/stream.h>
 #include <iprt/string.h>
 #include <iprt/ldr.h>
@@ -54,12 +51,8 @@
 // standard headers
 #include <map>
-#include <sstream>
 
 #ifdef __GNUC__
 #pragma GCC visibility pop
 #endif
-
-// shared webservice header
-#include "vboxweb.h"
 
 // include generated namespaces table
@@ -215,16 +208,22 @@
     va_list args;
     va_start(args, pszFormat);
-    RTPrintfV(pszFormat, args);
+    char *psz = NULL;
+    RTStrAPrintfV(&psz, pszFormat, args);
     va_end(args);
 
+    // terminal
+    RTPrintf("%s", psz);
+
+    // log file
     if (g_pstrLog)
     {
-        va_list args2;
-        va_start(args2, pszFormat);
-        RTStrmPrintfV(g_pstrLog, pszFormat, args);
-        va_end(args2);
-
+        RTStrmPrintf(g_pstrLog, "%s", psz);
         RTStrmFlush(g_pstrLog);
     }
+
+    // logger instance
+    RTLogLoggerEx(LOG_INSTANCE, RTLOGGRPFLAGS_DJ, LOG_GROUP, "%s", psz);
+
+    RTStrFree(psz);
 }
 
@@ -541,10 +540,10 @@
  */
 void RaiseSoapFault(struct soap *soap,
-                    const std::string &str,
+                    const char *pcsz,
                     int extype,
                     void *ex)
 {
     // raise the fault
-    soap_sender_fault(soap, str.c_str(), NULL);
+    soap_sender_fault(soap, pcsz, NULL);
 
     struct SOAP_ENV__Detail *pDetail = (struct SOAP_ENV__Detail*)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail));
@@ -587,5 +586,5 @@
 
     RaiseSoapFault(soap,
-                   str,
+                   str.c_str(),
                    SOAP_TYPE__vbox__InvalidObjectFault,
                    ex);
@@ -648,15 +647,8 @@
 
     // compose descriptive message
-    std::ostringstream ostr;
-    ostr << std::hex << ex->resultCode;
-
-    std::string str("VirtualBox error: ");
-    str += ex->text;
-    str += " (0x";
-    str += ostr.str();
-    str += ")";
+    com::Utf8StrFmt str("VirtualBox error: %s (0x%RU32)", ex->text.c_str(), ex->resultCode);
 
     RaiseSoapFault(soap,
-                   str,
+                   str.c_str(),
                    SOAP_TYPE__vbox__RuntimeFault,
                    ex);
@@ -934,4 +926,5 @@
         WSDLT_ID id = pRef->toWSDL();
         WEBDEBUG(("   %s: found existing ref %s for COM obj 0x%lX\n", __FUNCTION__, id.c_str(), ulp));
+        LogDJ(("   %s: found existing ref %s for COM obj 0x%lX\n", __FUNCTION__, id.c_str(), ulp));
     }
     else
@@ -1063,4 +1056,5 @@
 
     WEBDEBUG(("   * %s: MOR created for ulp 0x%lX (%s), new ID is %llX; now %lld objects total\n", __FUNCTION__, _ulp, pcszInterface, _id, cTotal));
+    LogDJ(("   * %s: MOR created for ulp 0x%lX (%s), new ID is %llX; now %lld objects total\n", __FUNCTION__, _ulp, pcszInterface, _id, cTotal));
 }
 
Index: /trunk/src/VBox/Main/webservice/vboxweb.h
===================================================================
--- /trunk/src/VBox/Main/webservice/vboxweb.h	(revision 22707)
+++ /trunk/src/VBox/Main/webservice/vboxweb.h	(revision 22708)
@@ -27,4 +27,17 @@
 
 #define WEBDEBUG(a) if (g_fVerbose) { WebLog a; }
+
+#define LOG_GROUP LOG_GROUP_WEBSERVICE
+#include <VBox/log.h>
+
+#include <VBox/com/VirtualBox.h>
+#include <VBox/com/Guid.h>
+
+#include <VBox/err.h>
+
+#include <iprt/stream.h>
+
+#include <string>
+
 
 /****************************************************************************
Index: /trunk/src/VBox/Main/webservice/websrv-cpp.xsl
===================================================================
--- /trunk/src/VBox/Main/webservice/websrv-cpp.xsl	(revision 22707)
+++ /trunk/src/VBox/Main/webservice/websrv-cpp.xsl	(revision 22708)
@@ -60,15 +60,15 @@
  */
 
+// shared webservice header
+#include "vboxweb.h"
+
 // vbox headers
 #include <VBox/com/com.h>
 #include <VBox/com/array.h>
-#include <VBox/com/string.h>
-#include <VBox/com/Guid.h>
 #include <VBox/com/ErrorInfo.h>
 #include <VBox/com/errorprint.h>
 #include <VBox/com/EventQueue.h>
-#include <VBox/com/VirtualBox.h>
-#include <VBox/err.h>
-#include <VBox/log.h>
+#include <VBox/VRDPAuth.h>
+#include <VBox/version.h>
 
 #include <iprt/initterm.h>
@@ -82,7 +82,4 @@
 #include <map>
 #include <sstream>
-
-// shared webservice header
-#include "vboxweb.h"
 
 // shared strings for debug output
