[Libreoffice-commits] core.git: vcl/headless vcl/source vcl/unx

Yukio Siraichi (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 20 08:25:11 UTC 2020


 vcl/headless/headlessinst.cxx                  |   13 
 vcl/source/fontsubset/cff.cxx                  |   12 
 vcl/source/fontsubset/fontsubset.cxx           |    3 
 vcl/source/fontsubset/sft.cxx                  |   37 +
 vcl/source/fontsubset/ttcr.cxx                 |   17 
 vcl/unx/generic/app/i18n_cb.cxx                |   42 +-
 vcl/unx/generic/app/i18n_ic.cxx                |    6 
 vcl/unx/generic/app/i18n_im.cxx                |   43 +-
 vcl/unx/generic/app/i18n_xkb.cxx               |   15 
 vcl/unx/generic/app/randrwrapper.cxx           |   12 
 vcl/unx/generic/app/saldata.cxx                |    4 
 vcl/unx/generic/app/saldisp.cxx                |  185 +++++----
 vcl/unx/generic/app/salinst.cxx                |    5 
 vcl/unx/generic/app/wmadaptor.cxx              |   39 +-
 vcl/unx/generic/dtrans/X11_clipboard.cxx       |   16 
 vcl/unx/generic/dtrans/X11_selection.cxx       |  486 +++++++++++++++----------
 vcl/unx/generic/dtrans/bmp.cxx                 |   26 -
 vcl/unx/generic/dtrans/config.cxx              |   17 
 vcl/unx/generic/fontmanager/fontconfig.cxx     |    6 
 vcl/unx/generic/fontmanager/fontmanager.cxx    |   15 
 vcl/unx/generic/fontmanager/fontsubst.cxx      |   56 +-
 vcl/unx/generic/gdi/salgdi.cxx                 |    8 
 vcl/unx/generic/print/genprnpsp.cxx            |   14 
 vcl/unx/generic/printer/printerinfomanager.cxx |   82 ++--
 vcl/unx/generic/window/salframe.cxx            |   38 +
 vcl/unx/generic/window/salobj.cxx              |   14 
 vcl/unx/gtk3/gtk3gtkframe.cxx                  |   26 -
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx      |   15 
 vcl/unx/gtk3/gtk3salprn-gtk.cxx                |    4 
 29 files changed, 770 insertions(+), 486 deletions(-)

New commits:
commit 317c05a88f79096422681a23b61aa6ae9f3f084b
Author:     Yukio Siraichi <yukio.siraichi at gmail.com>
AuthorDate: Thu Apr 16 12:47:29 2020 +0900
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Apr 20 10:24:18 2020 +0200

    tdf#130924 [vcl] replace `*printf`s with `SAL_*` logging macros.
    
    Change-Id: Ie3ec1e1767478bce12eecf7bfee02ed2d45fe58c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92331
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/headless/headlessinst.cxx b/vcl/headless/headlessinst.cxx
index c1bf1a7b7294..e1694c429d2b 100644
--- a/vcl/headless/headlessinst.cxx
+++ b/vcl/headless/headlessinst.cxx
@@ -31,9 +31,10 @@ public:
                                   const std::vector< OUString >& rButtons ) override
     {
         (void)rButtons;
-        ::fprintf(stdout, "LibreOffice - dialog '%s': '%s'",
-                            OUStringToOString(rTitle, RTL_TEXTENCODING_ASCII_US).getStr(),
-                            OUStringToOString(rMessage, RTL_TEXTENCODING_ASCII_US).getStr());
+        SAL_INFO("vcl.headless",
+                "LibreOffice - dialog '"
+                << rTitle << "': '"
+                << rMessage << "'");
         return 0;
     }
 };
@@ -56,10 +57,10 @@ void SalAbort( const OUString& rErrorText, bool bDumpCore )
     OUString aError( rErrorText );
     if( aError.isEmpty() )
         aError = "Unknown application error";
-    ::fprintf( stderr, "%s\n", OUStringToOString(rErrorText, osl_getThreadTextEncoding()).getStr() );
 
-    ::fprintf( stderr, "SalAbort: '%s'",
-                        OUStringToOString(aError, RTL_TEXTENCODING_ASCII_US).getStr());
+    SAL_WARN("vcl.headless", rErrorText);
+    SAL_INFO("vcl.headless", "SalAbort: '" << aError << "'.");
+
     if( bDumpCore )
         abort();
     else
diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index 98f0101f047f..dd7da8d92ae7 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -442,7 +442,7 @@ void CffSubsetterContext::readDictOp()
         //TODO: if( nStackIdx > 0)
         int nInt = 0;
         switch( *pCmdName) {
-        default: fprintf( stderr, "unsupported DictOp.type=\'%c\'\n", *pCmdName); break;
+        default: SAL_WARN("vcl.fonts", "unsupported DictOp.type='" << *pCmdName << "'."); break;
         case 'b':   // bool
             nInt = popInt();
             switch( nOpId) {
@@ -1051,7 +1051,7 @@ void CffSubsetterContext::convertOneTypeEsc()
         }
         break;
     default:
-        fprintf( stderr,"unhandled type2esc %d\n", nType2Esc);
+        SAL_WARN("vcl.fonts", "unhandled type2esc " << nType2Esc);
         assert( false);
         break;
     }
@@ -1226,7 +1226,7 @@ int CffSubsetterContext::seekIndexData( int nIndexBase, int nDataIndex)
     mpReadPtr += 3 + (nDataOfsSz * nDataIndex);
     int nOfs1 = 0;
     switch( nDataOfsSz) {
-        default: fprintf( stderr, "\tINVALID nDataOfsSz=%d\n\n", nDataOfsSz); return -1;
+        default: SAL_WARN("vcl.fonts", "\tINVALID nDataOfsSz=" << nDataOfsSz); return -1;
         case 1: nOfs1 = mpReadPtr[0]; break;
         case 2: nOfs1 = (mpReadPtr[0]<<8) + mpReadPtr[1]; break;
         case 3: nOfs1 = (mpReadPtr[0]<<16) + (mpReadPtr[1]<<8) + mpReadPtr[2]; break;
@@ -1262,7 +1262,7 @@ void CffSubsetterContext::seekIndexEnd( int nIndexBase)
     assert( mpReadPtr <= mpBaseEnd);
     int nEndOfs = 0;
     switch( nDataOfsSz) {
-        default: fprintf( stderr, "\tINVALID nDataOfsSz=%d\n\n", nDataOfsSz); return;
+        default: SAL_WARN("vcl.fonts", "\tINVALID nDataOfsSz=" << nDataOfsSz); return;
         case 1: nEndOfs = mpReadPtr[0]; break;
         case 2: nEndOfs = (mpReadPtr[0]<<8) + mpReadPtr[1]; break;
         case 3: nEndOfs = (mpReadPtr[0]<<16) + (mpReadPtr[1]<<8) + mpReadPtr[2];break;
@@ -1485,7 +1485,7 @@ int CffSubsetterContext::getFDSelect( int nGlyphIndex) const
                 }
             } break;
         default:    // invalid FDselect format
-            fprintf( stderr, "invalid CFF.FdselType=%d\n", nFDSelFormat);
+            SAL_WARN("vcl.fonts", "invalid CFF.FdselType=" << nFDSelFormat);
             break;
     }
 
@@ -1530,7 +1530,7 @@ int CffSubsetterContext::getGlyphSID( int nGlyphIndex) const
             }
             break;
         default:
-            fprintf( stderr, "ILLEGAL CFF-Charset format %d\n", nCSetFormat);
+            SAL_WARN("vcl.fonts", "ILLEGAL CFF-Charset format " << nCSetFormat);
             return -2;
     }
 
diff --git a/vcl/source/fontsubset/fontsubset.cxx b/vcl/source/fontsubset/fontsubset.cxx
index f92498e80247..8a4eeb9aa052 100644
--- a/vcl/source/fontsubset/fontsubset.cxx
+++ b/vcl/source/fontsubset/fontsubset.cxx
@@ -155,7 +155,8 @@ bool FontSubsetInfo::CreateFontSubsetFromSfnt( sal_Int32* pOutGlyphWidths )
 // TODO: replace dummy implementation
 bool FontSubsetInfo::CreateFontSubsetFromType1( const sal_Int32* /*pOutGlyphWidths*/)
 {
-    fprintf(stderr,"CreateFontSubsetFromType1: replace dummy implementation\n");
+    SAL_WARN("vcl.fonts",
+            "CreateFontSubsetFromType1: replace dummy implementation.");
     return false;
 }
 
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index cd3e6bbd2a2c..efba8ff594f3 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -520,14 +520,16 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo
         if( std::find( glyphlist.begin(), glyphlist.end(), index ) != glyphlist.end() )
         {
 #if OSL_DEBUG_LEVEL > 1
-            fprintf(stderr, "Endless loop found in a compound glyph.\n");
-            fprintf(stderr, "%d -> ", index);
-            fprintf(stderr," [");
+            SAL_INFO("vcl.fonts", "Endless loop found in a compound glyph.");
+
+            std::ostringstream oss;
+            oss << index << " -> [";
             for( const auto& rGlyph : glyphlist )
             {
-                fprintf( stderr,"%d ", (int) rGlyph );
+                oss << (int) rGlyph << " ";
             }
-            fprintf(stderr,"]\n");
+            oss << "]";
+            SAL_INFO("vcl.fonts", oss.str());
         /**/
 #endif
         }
@@ -538,7 +540,7 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo
         {
             /* XXX that probably indicates a corrupted font */
 #if OSL_DEBUG_LEVEL > 1
-            fprintf(stderr, "An empty compound!\n");
+            SAL_WARN("vcl.fonts", "An empty compound!");
             /* assert(!"An empty compound"); */
 #endif
         }
@@ -905,7 +907,7 @@ static void GetNames(TrueTypeFont *t)
     if (nTableSize < 6)
     {
 #if OSL_DEBUG_LEVEL > 1
-        fprintf(stderr, "O_name table too small\n");
+        SAL_WARN("vcl.fonts", "O_name table too small.");
 #endif
         return;
     }
@@ -1333,7 +1335,9 @@ static void FindCmap(TrueTypeFont *ttf)
             default:
 #if OSL_DEBUG_LEVEL > 1
                 /*- if the cmap table is really broken */
-                printf("%s: %d is not a recognized cmap format.\n", ttf->fname, GetUInt16(ttf->cmap, 0));
+                SAL_WARN("vcl.fonts", ttf->fname << ": "
+                        << GetUInt16(ttf->cmap, 0)
+                        << " is not a recognized cmap format..");
 #endif
                 ttf->cmapType = CMAP_NOT_USABLE;
                 ttf->cmap = nullptr;
@@ -1594,8 +1598,10 @@ static SFErrCodes doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
         if( t->tables[i] < t->ptr )
         {
 #if OSL_DEBUG_LEVEL > 1
-            if( t->tables[i] )
-                fprintf( stderr, "font file %s has bad table offset %" SAL_PRI_PTRDIFFT "d (tagnum=%d)\n", t->fname, (sal_uInt8*)t->tables[i]-t->ptr, i );
+            SAL_WARN_IF(t->tables[i], "vcl.fonts", "font file " << t->fname
+                    << " has bad table offset "
+                    << (sal_uInt8*)t->tables[i]-t->ptr
+                    << "d (tagnum=" << i << ").");
 #endif
             t->tlens[i] = 0;
             t->tables[i] = nullptr;
@@ -1607,7 +1613,8 @@ static SFErrCodes doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
                 nMaxLen = 0;
             t->tlens[i] = nMaxLen;
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "font file %s has too big table (tagnum=%d)\n", t->fname, i );
+            SAL_WARN("vcl.fonts", "font file " << t->fname
+                    << " has too big table (tagnum=" << i << ").");
 #endif
         }
     }
@@ -1991,11 +1998,11 @@ SFErrCodes CreateTTFromTTGlyphs(TrueTypeFont  *ttf,
     AddTable(ttcr, cvt ); AddTable(ttcr, prep); AddTable(ttcr, fpgm);
     AddTable(ttcr, post); AddTable(ttcr, os2);
 
-    if ((res = StreamToFile(ttcr, fname)) != SFErrCodes::Ok) {
+    res = StreamToFile(ttcr, fname);
 #if OSL_DEBUG_LEVEL > 1
-        fprintf(stderr, "StreamToFile: error code: %d.\n", int(res));
+    SAL_WARN_IF(res != SFErrCodes::Ok, "vcl.fonts", "StreamToFile: error code: "
+            << (int) res << ".");
 #endif
-    }
 
     TrueTypeCreatorDispose(ttcr);
     free(gID);
@@ -2504,7 +2511,7 @@ int GetTTNameRecords(TrueTypeFont const *ttf, NameRecord **nr)
     if (nTableSize < 6)
     {
 #if OSL_DEBUG_LEVEL > 1
-        fprintf(stderr, "O_name table too small\n");
+        SAL_WARN("vcl.fonts", "O_name table too small.");
 #endif
         return 0;
     }
diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index 92ecfa9a87a6..62690a2157b2 100644
--- a/vcl/source/fontsubset/ttcr.cxx
+++ b/vcl/source/fontsubset/ttcr.cxx
@@ -21,8 +21,11 @@
  * TrueTypeCreator method implementation
  */
 
+#include <iomanip>
 #include <assert.h>
 
+#include <sal/log.hxx>
+
 #include "ttcr.hxx"
 #include "list.h"
 #include <string.h>
@@ -460,7 +463,12 @@ static void TrueTypeTableDispose_post(TrueTypeTable *_this)
             if (p->format == 0x00030000) {
                 /* do nothing */
             } else {
-                fprintf(stderr, "Unsupported format of a 'post' table: %08X.\n", static_cast<int>(p->format));
+                SAL_WARN("vcl.fonts", "Unsupported format of a 'post' table: "
+                        << std::setfill('0')
+                        << std::setw(8)
+                        << std::hex
+                        << std::uppercase
+                        << static_cast<int>(p->format) << ".");
             }
             free(p);
         }
@@ -780,7 +788,12 @@ static int GetRawData_post(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le
         PutUInt16(static_cast<sal_uInt16>(p->isFixedPitch), post, 12);
         ret = TTCR_OK;
     } else {
-        fprintf(stderr, "Unrecognized format of a post table: %08X.\n", static_cast<int>(p->format));
+        SAL_WARN("vcl.fonts", "Unrecognized format of a post table: "
+                << std::setfill('0')
+                << std::setw(8)
+                << std::hex
+                << std::uppercase
+                << static_cast<int>(p->format) << ".");
         ret = TTCR_POSTFORMAT;
     }
 
diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx
index b6c6326879fd..2944c85480cc 100644
--- a/vcl/unx/generic/app/i18n_cb.cxx
+++ b/vcl/unx/generic/app/i18n_cb.cxx
@@ -22,6 +22,7 @@
 
 #include <o3tl/safeint.hxx>
 #include <osl/thread.h>
+#include <sal/log.hxx>
 
 #include <X11/Xlib.h>
 
@@ -97,8 +98,10 @@ Preedit_DeleteText(preedit_text_t *ptext, int from, int howmuch)
     else
     {
           // XXX this indicates an error, are we out of sync ?
-          fprintf(stderr, "Preedit_DeleteText( from=%i to=%i length=%i )\n",
-                from, to, ptext->nLength );
+          SAL_INFO("vcl.app", "Preedit_DeleteText( from=" << from
+                  << " to=" << to
+                  << " length=" << ptext->nLength
+                  << " ).");
           fprintf (stderr, "\t XXX internal error, out of sync XXX\n");
 
           ptext->nLength = from;
@@ -225,8 +228,9 @@ Preedit_UpdateAttributes ( preedit_text_t* ptext, XIMFeedback const * feedback,
     if ( (from + amount) > static_cast<int>(ptext->nLength) )
     {
         // XXX this indicates an error, are we out of sync ?
-        fprintf (stderr, "Preedit_UpdateAttributes( %i + %i > %i )\n",
-            from, amount, ptext->nLength );
+        SAL_INFO("vcl.app", "Preedit_UpdateAttributes( "
+                << from << " + " << amount << " > " << ptext->nLength
+                << " ).");
         fprintf (stderr, "\t XXX internal error, out of sync XXX\n");
 
         return;
@@ -398,12 +402,7 @@ GetPreeditSpotLocation(XIC ic, XPointer client_data)
 void
 PreeditCaretCallback ( XIC ic, XPointer client_data,
     XIMPreeditCaretCallbackStruct *call_data )
-#else
-void
-PreeditCaretCallback ( XIC, XPointer,XIMPreeditCaretCallbackStruct* )
-#endif
 {
-    #if OSL_DEBUG_LEVEL > 1
     // XXX PreeditCaretCallback is pure debug code for now
     const char *direction = "?";
     const char *style = "?";
@@ -430,12 +429,20 @@ PreeditCaretCallback ( XIC, XPointer,XIMPreeditCaretCallbackStruct* )
         case XIMDontChange:   direction = "Don't change";  break;
     }
 
-    fprintf (stderr, "PreeditCaretCallback( ic=%p, client=%p,\n",
-        ic, client_data );
-    fprintf (stderr, "\t position=%i, direction=\"%s\", style=\"%s\" )\n",
-        call_data->position, direction, style );
-    #endif
+    SAL_INFO("vcl.app", "PreeditCaretCallback( ic=" << ic
+            << ", client=" << client_data
+            << ",");
+    SAL_INFO("vcl.app", "\t position=" << call_data->position
+            << ", direction=\"" << direction
+            << "\", style=\"" << style
+            << "\" ).");
+}
+#else
+void
+PreeditCaretCallback ( XIC, XPointer, XIMPreeditCaretCallbackStruct* )
+{
 }
+#endif
 
 // v. commit string callback: convert an extended text input (iiimp ... )
 //     into an ordinary key-event
@@ -497,8 +504,11 @@ StatusDrawCallback (XIC, XPointer, XIMStatusDrawCallbackStruct *call_data)
 #if OSL_DEBUG_LEVEL > 1
     else
     {
-        fprintf( stderr, "XIMStatusDataType %s not supported\n",
-            call_data->type == XIMBitmapType ? "XIMBitmapType" : OString::number(call_data->type).getStr() );
+        SAL_WARN("vcl.app", "XIMStatusDataType "
+                << ((call_data->type == XIMBitmapType) ?
+                    "XIMBitmapType" :
+                    OString::number(call_data->type))
+                << " not supported.");
     }
 #endif
 }
diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx
index 63dbdbd9c0ab..ad42c079c379 100644
--- a/vcl/unx/generic/app/i18n_ic.cxx
+++ b/vcl/unx/generic/app/i18n_ic.cxx
@@ -25,6 +25,8 @@
 #include <unx/salframe.h>
 #include <unx/saldisp.hxx>
 
+#include <sal/log.hxx>
+
 using namespace vcl;
 
 static void sendEmptyCommit( SalFrame* pFrame )
@@ -315,7 +317,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) :
     if ( maContext == nullptr )
     {
 #if OSL_DEBUG_LEVEL > 1
-        fprintf(stderr, "input context creation failed\n");
+        SAL_WARN("vcl.app", "input context creation failed.");
 #endif
 
         mbUseable = False;
@@ -508,7 +510,7 @@ SalI18N_InputContext::CommitKeyEvent(sal_Unicode const * pText, std::size_t nLen
     }
 #if OSL_DEBUG_LEVEL > 1
     else
-        fprintf(stderr, "CommitKeyEvent without frame\n" );
+        SAL_WARN("vcl.app", "CommitKeyEvent without frame.");
 #endif
 }
 
diff --git a/vcl/unx/generic/app/i18n_im.cxx b/vcl/unx/generic/app/i18n_im.cxx
index 18ad9a3f0f8a..a9e9fb42fb87 100644
--- a/vcl/unx/generic/app/i18n_im.cxx
+++ b/vcl/unx/generic/app/i18n_im.cxx
@@ -19,6 +19,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <iostream>
 
 #ifdef LINUX
 #  ifndef __USE_XOPEN
@@ -32,6 +33,7 @@
 
 #include <osl/thread.h>
 #include <osl/process.h>
+#include <sal/log.hxx>
 
 #include <unx/i18n_cb.hxx>
 
@@ -124,13 +126,11 @@ XKeyEventOp::match (const XKeyEvent &rEvent) const
 static char*
 SetSystemLocale( const char* p_inlocale )
 {
-    char *p_outlocale;
+    char *p_outlocale = setlocale(LC_ALL, p_inlocale);
 
-    if ( (p_outlocale = setlocale(LC_ALL, p_inlocale)) == nullptr )
-    {
-        fprintf( stderr, "I18N: Operating system doesn't support locale \"%s\"\n",
-            p_inlocale );
-    }
+    SAL_WARN_IF(p_outlocale == nullptr, "vcl.app",
+            "I18N: Operating system doesn't support locale \""
+            << p_inlocale << "\".");
 
     return p_outlocale;
 }
@@ -170,8 +170,9 @@ IsXWindowCompatibleLocale( const char* p_locale )
 
     if ( !XSupportsLocale() )
     {
-        fprintf (stderr, "I18N: X Window System doesn't support locale \"%s\"\n",
-                p_locale );
+        SAL_WARN("vcl.app",
+                "I18N: X Window System doesn't support locale \""
+                << p_locale << "\".");
         return False;
     }
     return True;
@@ -215,8 +216,9 @@ SalI18N_InputMethod::SetLocale()
         // must not fail if mbUseable since XSupportsLocale() asserts success
         if ( mbUseable && XSetLocaleModifiers("") == nullptr )
         {
-            fprintf (stderr, "I18N: Can't set X modifiers for locale \"%s\"\n",
-                locale);
+            SAL_WARN("vcl.app",
+                    "I18N: Can't set X modifiers for locale \""
+                    << locale << "\".");
             mbUseable = False;
         }
     }
@@ -305,12 +307,14 @@ PrintInputStyle( XIMStyles *pStyle )
     int  nBuf = sizeof( pBuf );
 
     if ( pStyle == NULL )
-        fprintf( stderr, "no input method styles\n");
+        SAL_INFO("vcl.app", "no input method styles.");
     else
     for ( int nStyle = 0; nStyle < pStyle->count_styles; nStyle++ )
     {
-        fprintf( stderr, "style #%i = %s\n", nStyle,
-              GetMethodName(pStyle->supported_styles[nStyle], pBuf, nBuf) );
+        SAL_INFO("vcl.app", "style #"
+                << nStyle
+                << " = "
+                << GetMethodName(pStyle->supported_styles[nStyle], pBuf, nBuf));
     }
 }
 
@@ -339,10 +343,10 @@ SalI18N_InputMethod::CreateMethod ( Display *pDisplay )
             if (   XGetIMValues(maMethod, XNQueryInputStyle, &mpStyles, nullptr)
                 != nullptr)
                 mbUseable = False;
-            #if OSL_DEBUG_LEVEL > 1
-            fprintf(stderr, "Creating Mono-Lingual InputMethod\n" );
+#if OSL_DEBUG_LEVEL > 1
+            SAL_INFO("vcl.app", "Creating Mono-Lingual InputMethod.");
             PrintInputStyle( mpStyles );
-            #endif
+#endif
         }
         else
         {
@@ -350,10 +354,9 @@ SalI18N_InputMethod::CreateMethod ( Display *pDisplay )
         }
     }
 
-    #if OSL_DEBUG_LEVEL > 1
-    if ( !mbUseable )
-        fprintf(stderr, "input method creation failed\n");
-    #endif
+#if OSL_DEBUG_LEVEL > 1
+    SAL_WARN_IF(!mbUseable, "vcl.app", "input method creation failed.");
+#endif
 
     maDestroyCallback.callback    = IM_IMDestroyCallback;
     maDestroyCallback.client_data = reinterpret_cast<XPointer>(this);
diff --git a/vcl/unx/generic/app/i18n_xkb.cxx b/vcl/unx/generic/app/i18n_xkb.cxx
index db3c83752e5d..0fc4d7933fc3 100644
--- a/vcl/unx/generic/app/i18n_xkb.cxx
+++ b/vcl/unx/generic/app/i18n_xkb.cxx
@@ -19,6 +19,9 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <iostream>
+
+#include <sal/log.hxx>
 
 #include <X11/Xlib.h>
 #include <X11/XKBlib.h>
@@ -90,11 +93,13 @@ SalI18N_KeyboardExtension::Dispatch( XEvent* pEvent )
             break;
 
         default:
-
-            #if OSL_DEBUG_LEVEL > 1
-            fprintf(stderr, "Got unrequested XkbAnyEvent %#x/%i\n",
-                    static_cast<unsigned int>(nXKBType), static_cast<int>(nXKBType) );
-            #endif
+#if OSL_DEBUG_LEVEL > 1
+            SAL_WARN("vcl.app", "Got unrequested XkbAnyEvent "
+                    << std::hex << std::showbase
+                    << static_cast<unsigned int>(nXKBType)
+                    << "/" << std::dec
+                    << static_cast<int>(nXKBType));
+#endif
             break;
     }
 }
diff --git a/vcl/unx/generic/app/randrwrapper.cxx b/vcl/unx/generic/app/randrwrapper.cxx
index e7e23ce6b817..cb3698365968 100644
--- a/vcl/unx/generic/app/randrwrapper.cxx
+++ b/vcl/unx/generic/app/randrwrapper.cxx
@@ -22,6 +22,8 @@
 #include <X11/Xlib.h>
 #include <X11/extensions/Xrandr.h>
 
+#include <sal/log.hxx>
+
 namespace
 {
 
@@ -120,7 +122,7 @@ void SalDisplay::DeInitRandR()
     #ifdef USE_RANDR
     RandRWrapper::releaseWrapper();
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "SalDisplay::DeInitRandR()\n" );
+    SAL_INFO("vcl.app", "SalDisplay::DeInitRandR().");
 #endif
     #endif
 }
@@ -159,9 +161,11 @@ void SalDisplay::processRandREvent( XEvent* pEvent )
 
                     pWrapper->XRRFreeScreenConfigInfo( pConfig );
 
-                    #if OSL_DEBUG_LEVEL > 1
-                    fprintf( stderr, "screen %d changed to size %dx%d\n", (int)nId, (int)pTargetSize->width, (int)pTargetSize->height );
-                    #endif
+#if OSL_DEBUG_LEVEL > 1
+                    SAL_INFO("vcl.app", "screen " << nId
+                            << " changed to size " << (int)pTargetSize->width
+                            << "x" << (int)pTargetSize->height);
+#endif
                 }
             }
             if( bNotify )
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index e48e71761b60..f2fe146f515e 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -703,7 +703,7 @@ SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
     if( nFound < 0 ) // error
     {
 #ifdef DBG_UTIL
-        std::fprintf( stderr, "SalXLib::Yield e=%d f=%d\n", errno, nFound );
+        SAL_INFO("vcl.app", "SalXLib::Yield e=" << errno << " f=" << nFound);
 #endif
         if( EINTR == errno )
         {
@@ -747,7 +747,7 @@ SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
             {
                 if ( FD_ISSET( nFD, &ExceptionFDS ) ) {
 #if OSL_DEBUG_LEVEL > 1
-                    std::fprintf( stderr, "SalXLib::Yield exception\n" );
+                    SAL_WARN("vcl.app", "SalXLib::Yield exception.");
 #endif
                     nFound--;
                 }
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index b26fe54323bd..7e23b1046f5a 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -62,6 +62,7 @@
 #include <vcl/keycodes.hxx>
 #include <unx/salbmp.h>
 #include <osl/diagnose.h>
+#include <sal/log.hxx>
 #include <unx/salobj.h>
 #include <unx/sm.hxx>
 #include <unx/wmadaptor.hxx>
@@ -282,7 +283,7 @@ SalDisplay::SalDisplay( Display *display ) :
         m_nLastUserEventTime( CurrentTime )
 {
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "SalDisplay::SalDisplay()\n" );
+    SAL_INFO("vcl.app", "SalDisplay::SalDisplay().");
 #endif
     GenericUnixSalData *pData = GetGenericUnixSalData();
 
@@ -295,13 +296,13 @@ SalDisplay::SalDisplay( Display *display ) :
 SalDisplay::~SalDisplay()
 {
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "SalDisplay::~SalDisplay()\n" );
+    SAL_INFO("vcl.app", "SalDisplay::~SalDisplay().");
 #endif
     if( pDisp_ )
     {
         doDestruct();
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "display %p closed\n", pDisp_ );
+        SAL_INFO("vcl.app", "display " << pDisp_ << " closed.");
 #endif
         pDisp_ = nullptr;
     }
@@ -431,7 +432,7 @@ SalX11Display::SalX11Display( Display *display )
 SalX11Display::~SalX11Display()
 {
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "SalX11Display::~SalX11Display()\n" );
+    SAL_INFO("vcl.app", "SalX11Display::~SalX11Display().");
 #endif
     if( pDisp_ )
     {
@@ -2087,68 +2088,60 @@ void SalDisplay::DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) cons
 
     if( pEvent->type <= MappingNotify )
     {
-        fprintf( stderr, "[%s] %s s=%d w=%ld\n",
-                 pComment,
-                 EventNames[pEvent->type],
-                 pEvent->xany.send_event,
-                 pEvent->xany.window );
+        SAL_INFO("vcl.app", "[" << pComment << "] "
+                << EventNames[pEvent->type]
+                << " s=" << pEvent->xany.send_event
+                << " w=" << pEvent->xany.window);
 
         switch( pEvent->type )
         {
             case KeyPress:
             case KeyRelease:
-                fprintf( stderr, "\t\ts=%d c=%d\n",
-                         pEvent->xkey.state,
-                         pEvent->xkey.keycode );
+                SAL_INFO("vcl.app", "\t\ts=" << pEvent->xkey.state
+                        << " c=" << pEvent->xkey.keycode);
                 break;
 
             case ButtonPress:
             case ButtonRelease:
-                fprintf( stderr, "\t\ts=%d b=%d x=%d y=%d rx=%d ry=%d\n",
-                         pEvent->xbutton.state,
-                         pEvent->xbutton.button,
-                         pEvent->xbutton.x,
-                         pEvent->xbutton.y,
-                         pEvent->xbutton.x_root,
-                         pEvent->xbutton.y_root );
+                SAL_INFO("vcl.app", "\t\ts=" << pEvent->xbutton.state
+                         << " b=" << pEvent->xbutton.button
+                         << " x=" << pEvent->xbutton.x
+                         << " y=" << pEvent->xbutton.y
+                         << " rx=" << pEvent->xbutton.x_root
+                         << " ry=" << pEvent->xbutton.y_root);
                 break;
 
             case MotionNotify:
-                fprintf( stderr, "\t\ts=%d x=%d y=%d\n",
-                         pEvent->xmotion.state,
-                         pEvent->xmotion.x,
-                         pEvent->xmotion.y );
+                SAL_INFO("vcl.app", "\t\ts=" << pEvent->xmotion.state
+                         << " x=" << pEvent->xmotion.x
+                         << " y=" << pEvent->xmotion.y);
                 break;
 
             case EnterNotify:
             case LeaveNotify:
-                fprintf( stderr, "\t\tm=%d f=%d x=%d y=%d\n",
-                         pEvent->xcrossing.mode,
-                         pEvent->xcrossing.focus,
-                         pEvent->xcrossing.x,
-                         pEvent->xcrossing.y );
+                SAL_INFO("vcl.app", "\t\tm=" << pEvent->xcrossing.mode
+                         << " f=" << pEvent->xcrossing.focus
+                         << " x=" << pEvent->xcrossing.x
+                         << " y=" << pEvent->xcrossing.y);
                 break;
 
             case FocusIn:
             case FocusOut:
-                fprintf( stderr, "\t\tm=%d d=%d\n",
-                         pEvent->xfocus.mode,
-                         pEvent->xfocus.detail );
+                SAL_INFO("vcl.app", "\t\tm=" << pEvent->xfocus.mode
+                         << " d=" << pEvent->xfocus.detail);
                 break;
 
             case Expose:
             case GraphicsExpose:
-                fprintf( stderr, "\t\tc=%d %d*%d %d+%d\n",
-                         pEvent->xexpose.count,
-                         pEvent->xexpose.width,
-                         pEvent->xexpose.height,
-                         pEvent->xexpose.x,
-                         pEvent->xexpose.y );
+                SAL_INFO("vcl.app", "\t\tc=" << pEvent->xexpose.count
+                         << " " << pEvent->xexpose.width
+                         << "*" << pEvent->xexpose.height
+                         << " " << pEvent->xexpose.x
+                         << "+" << pEvent->xexpose.y );
                 break;
 
             case VisibilityNotify:
-                fprintf( stderr, "\t\ts=%d\n",
-                         pEvent->xvisibility.state );
+                SAL_INFO("vcl.app", "\t\ts=" << pEvent->xvisibility.state);
                 break;
 
             case CreateNotify:
@@ -2160,65 +2153,67 @@ void SalDisplay::DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) cons
                 break;
 
             case ReparentNotify:
-                fprintf( stderr, "\t\tp=%d x=%d y=%d\n",
-                         sal::static_int_cast< int >(pEvent->xreparent.parent),
-                         pEvent->xreparent.x,
-                         pEvent->xreparent.y );
+                SAL_INFO("vcl.app", "\t\tp=" << sal::static_int_cast< int >(
+                            pEvent->xreparent.parent)
+                         << " x=" << pEvent->xreparent.x
+                         << " y=" << pEvent->xreparent.y );
                 break;
 
             case ConfigureNotify:
-                fprintf( stderr, "\t\tb=%d %d*%d %d+%d\n",
-                         pEvent->xconfigure.border_width,
-                         pEvent->xconfigure.width,
-                         pEvent->xconfigure.height,
-                         pEvent->xconfigure.x,
-                         pEvent->xconfigure.y );
+                SAL_INFO("vcl.app", "\t\tb=" << pEvent->xconfigure.border_width
+                         << " " << pEvent->xconfigure.width
+                         << "*" << pEvent->xconfigure.height
+                         << " " << pEvent->xconfigure.x
+                         << "+" << pEvent->xconfigure.y);
                 break;
 
             case PropertyNotify:
-                fprintf( stderr, "\t\ta=%s (0x%X)\n",
-                         GetAtomName( pDisp_, pEvent->xproperty.atom ),
-                         sal::static_int_cast< unsigned int >(
-                             pEvent->xproperty.atom) );
+                SAL_INFO("vcl.app", "\t\ta=" << GetAtomName(
+                            pDisp_, pEvent->xproperty.atom)
+                        << std::showbase << std::hex << std::uppercase
+                        << " (" << sal::static_int_cast< unsigned int >(
+                            pEvent->xproperty.atom) << ").");
                 break;
 
             case ColormapNotify:
-                fprintf( stderr, "\t\tc=%ld n=%d s=%d\n",
-                         pEvent->xcolormap.colormap,
-                         pEvent->xcolormap.c_new,
-                         pEvent->xcolormap.state );
+                SAL_INFO("vcl.app", "\t\tc=" << pEvent->xcolormap.colormap
+                         << " n=" << pEvent->xcolormap.c_new
+                         << " s=" << pEvent->xcolormap.state);
                 break;
 
             case ClientMessage:
-                fprintf( stderr, "\t\ta=%s (0x%X) f=%i [0x%lX,0x%lX,0x%lX,0x%lX,0x%lX])\n",
-                         GetAtomName( pDisp_, pEvent->xclient.message_type ),
-                         sal::static_int_cast< unsigned int >(
-                             pEvent->xclient.message_type),
-                         pEvent->xclient.format,
-                         pEvent->xclient.data.l[0],
-                         pEvent->xclient.data.l[1],
-                         pEvent->xclient.data.l[2],
-                         pEvent->xclient.data.l[3],
-                         pEvent->xclient.data.l[4] );
+                SAL_INFO("vcl.app", "\t\ta=" << GetAtomName(
+                            pDisp_, pEvent->xclient.message_type)
+                         << std::showbase << std::hex << std::uppercase
+                         << " (" << sal::static_int_cast< unsigned int >(
+                             pEvent->xclient.message_type) << ")"
+                         << std::dec
+                         << " f=" << pEvent->xclient.format
+                         << std::hex
+                         << " [" << pEvent->xclient.data.l[0]
+                         << "," << pEvent->xclient.data.l[1]
+                         << "," << pEvent->xclient.data.l[2]
+                         << "," << pEvent->xclient.data.l[3]
+                         << "," << pEvent->xclient.data.l[4]
+                         << "]");
                 break;
 
             case MappingNotify:
-                fprintf( stderr, "\t\tr=%sd\n",
-                         MappingModifier == pEvent->xmapping.request
-                         ? "MappingModifier"
-                         : MappingKeyboard == pEvent->xmapping.request
-                           ? "MappingKeyboard"
-                           : "MappingPointer" );
+                SAL_INFO("vcl.app", "\t\tr="
+                        << (MappingModifier == pEvent->xmapping.request ?
+                            "MappingModifier" :
+                            (MappingKeyboard == pEvent->xmapping.request ?
+                             "MappingKeyboard" : "MappingPointer"))
+                        << "d");
 
                 break;
         }
     }
     else
-        fprintf( stderr, "[%s] %d s=%d w=%ld\n",
-                 pComment,
-                 pEvent->type,
-                 pEvent->xany.send_event,
-                 pEvent->xany.window );
+        SAL_INFO("vcl.app", "[" << pComment << "] "
+                << pEvent->type
+                << " s=" << pEvent->xany.send_event
+                << " w=" << pEvent->xany.window);
 }
 
 void SalDisplay::PrintInfo() const
@@ -2321,7 +2316,11 @@ void SalDisplay::InitXinerama()
     if( m_bXinerama )
     {
         for (auto const& screen : m_aXineramaScreens)
-            fprintf( stderr, "Xinerama screen: %ldx%ld+%ld+%ld\n", screen.GetWidth(), screen.GetHeight(), screen.Left(), screen.Top() );
+            SAL_INFO("vcl.app", "Xinerama screen: "
+                    << screen.GetWidth()
+                    << "x" << screen.GetHeight()
+                    << "+" << screen.Left()
+                    << "+" << screen.Top());
     }
 #endif
 }
@@ -2837,9 +2836,21 @@ Pixel SalColormap::GetPixel( Color nColor ) const
                             const_cast<SalColormap*>(this)->m_aPalette[aInversColor.pixel] = nInversColor;
 #ifdef DBG_UTIL
                         else
-                            fprintf( stderr, "SalColormap::GetPixel() 0x%06lx=%lu 0x%06lx=%lu\n",
-                                     static_cast< unsigned long >(sal_uInt32(nColor)), aColor.pixel,
-                                     static_cast< unsigned long >(sal_uInt32(nInversColor)), aInversColor.pixel);
+                            SAL_INFO("vcl.app", "SalColormap::GetPixel() "
+                                    << std::showbase << std::setfill('0')
+                                    << std::setw(6) << std::hex
+                                    << static_cast< unsigned long >(
+                                        sal_uInt32(nColor))
+                                    << "="
+                                    << std::dec
+                                    << aColor.pixel << " "
+                                    << std::showbase << std::setfill('0')
+                                    << std::setw(6) << std::hex
+                                    << static_cast< unsigned long >(
+                                        sal_uInt32(nInversColor))
+                                    << "="
+                                    << std::dec
+                                    << aInversColor.pixel);
 #endif
                     }
                 }
@@ -2848,16 +2859,18 @@ Pixel SalColormap::GetPixel( Color nColor ) const
             }
 
 #ifdef DBG_UTIL
-            fprintf( stderr, "SalColormap::GetPixel() !XAllocColor %lx\n",
-                     static_cast< unsigned long >(sal_uInt32(nColor)) );
+            SAL_INFO("vcl.app", "SalColormap::GetPixel() !XAllocColor "
+                    << std::hex
+                    << static_cast< unsigned long >(sal_uInt32(nColor)));
 #endif
         }
 
         if( m_aPalette.empty() )
         {
 #ifdef DBG_UTIL
-            fprintf( stderr, "SalColormap::GetPixel() Palette empty %lx\n",
-                     static_cast< unsigned long >(sal_uInt32(nColor)));
+            SAL_INFO("vcl.app", "SalColormap::GetPixel() Palette empty "
+                    << std::hex
+                    << static_cast< unsigned long >(sal_uInt32(nColor)));
 #endif
             return sal_uInt32(nColor);
         }
diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx
index 20dbeb844dfb..21d878cfa612 100644
--- a/vcl/unx/generic/app/salinst.cxx
+++ b/vcl/unx/generic/app/salinst.cxx
@@ -172,7 +172,10 @@ bool X11SalInstance::AnyInput(VclInputFlags nType)
         bRet = aInput.bRet;
     }
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "AnyInput 0x%x = %s\n", static_cast<unsigned int>(nType), bRet ? "true" : "false" );
+    SAL_INFO("vcl.app", "AnyInput "
+            << std::showbase << std::hex
+            << static_cast<unsigned int>(nType)
+            << " = " << (bRet ? "true" : "false"));
 #endif
     return bRet;
 }
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index d6034ea333f6..39aaf007344e 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -26,6 +26,7 @@
 #include <osl/thread.h>
 #include <osl/process.h>
 #include <sal/macros.h>
+#include <sal/log.hxx>
 #include <configsettings.hxx>
 
 #include <unx/wmadaptor.hxx>
@@ -183,7 +184,7 @@ std::unique_ptr<WMAdaptor> WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay )
     }
 #if OSL_DEBUG_LEVEL > 1
     else
-        fprintf( stderr, "WM supports extended WM hints\n" );
+        SAL_INFO("vcl.app", "WM supports extended WM hints.");
 #endif
 
     // try a GnomeWM
@@ -196,7 +197,7 @@ std::unique_ptr<WMAdaptor> WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay )
         }
 #if OSL_DEBUG_LEVEL > 1
         else
-            fprintf( stderr, "WM supports GNOME WM hints\n" );
+            SAL_INFO("vcl.app", "WM supports GNOME WM hints.");
 #endif
     }
 
@@ -204,9 +205,9 @@ std::unique_ptr<WMAdaptor> WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay )
         pAdaptor.reset(new WMAdaptor( pSalDisplay ));
 
 #if OSL_DEBUG_LEVEL > 1
-    fprintf(stderr, "Window Manager's name is \"%s\"\n",
-        OUStringToOString(pAdaptor->getWindowManagerName(),
-        RTL_TEXTENCODING_UTF8).getStr());
+    SAL_INFO("vcl.app", "Window Manager's name is \""
+            << pAdaptor->getWindowManagerName()
+            << "\".");
 #endif
     return pAdaptor;
 }
@@ -386,7 +387,7 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
             if( XGetAtomNames( m_pDisplay, pAtoms, nItems, pAtomNames ) )
             {
 #if OSL_DEBUG_LEVEL > 1
-                fprintf( stderr, "supported protocols:\n" );
+                SAL_INFO("vcl.app", "supported protocols:");
 #endif
                 for( unsigned long i = 0; i < nItems; i++ )
                 {
@@ -409,7 +410,10 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
                             m_bEnableAlwaysOnTopWorks = true;
                     }
 #if OSL_DEBUG_LEVEL > 1
-                    fprintf( stderr, "  %s%s\n", pAtomNames[i], ((pMatch)&&(pMatch->nProtocol != -1)) ? "" : " (unsupported)" );
+                    SAL_INFO("vcl.app", "  "
+                            << pAtomNames[i]
+                            << (((pMatch)&&(pMatch->nProtocol != -1)) ?
+                                "" : " (unsupported)"));
 #endif
                     XFree( pAtomNames[i] );
                 }
@@ -472,12 +476,11 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
                     if( aWorkArea != m_aWMWorkAreas[0] )
                         m_bEqualWorkAreas = false;
 #if OSL_DEBUG_LEVEL > 1
-                    fprintf( stderr, "workarea %d: %ldx%ld+%ld+%ld\n",
-                             i,
-                             m_aWMWorkAreas[i].GetWidth(),
-                             m_aWMWorkAreas[i].GetHeight(),
-                             m_aWMWorkAreas[i].Left(),
-                             m_aWMWorkAreas[i].Top() );
+                    SAL_INFO("vcl.app", "workarea " << i
+                            << ": " << m_aWMWorkAreas[i].GetWidth()
+                            << "x"  << m_aWMWorkAreas[i].GetHeight()
+                            << "+"  << m_aWMWorkAreas[i].Left()
+                            << "+"  << m_aWMWorkAreas[i].Top());
 #endif
                 }
                 XFree( pProperty );
@@ -485,7 +488,8 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) :
             else
             {
 #if OSL_DEBUG_LEVEL > 1
-                fprintf( stderr, "%ld workareas for %d desktops !\n", nItems/4, m_nDesktops );
+                SAL_INFO("vcl.app", nItems/4 << " workareas for "
+                        << m_nDesktops << " desktops !");
 #endif
                 if( pProperty )
                 {
@@ -636,7 +640,7 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
             if( XGetAtomNames( m_pDisplay, pAtoms, nItems, pAtomNames ) )
             {
 #if OSL_DEBUG_LEVEL > 1
-                fprintf( stderr, "supported protocols:\n" );
+                SAL_INFO("vcl.app", "supported protocols:");
 #endif
                 for( unsigned long i = 0; i < nItems; i++ )
                 {
@@ -665,7 +669,10 @@ GnomeWMAdaptor::GnomeWMAdaptor( SalDisplay* pSalDisplay ) :
                         m_nInitWinGravity = NorthWestGravity;
                     }
 #if OSL_DEBUG_LEVEL > 1
-                    fprintf( stderr, "  %s%s\n", pAtomNames[i], ((pMatch) && (pMatch->nProtocol != -1)) ? "" : " (unsupported)" );
+                    SAL_INFO("vcl.app", "  "
+                            << pAtomNames[i]
+                            << (((pMatch) && (pMatch->nProtocol != -1)) ?
+                                "" : " (unsupported)"));
 #endif
                     XFree( pAtomNames[i] );
                 }
diff --git a/vcl/unx/generic/dtrans/X11_clipboard.cxx b/vcl/unx/generic/dtrans/X11_clipboard.cxx
index 8740f2418538..17104ca75eca 100644
--- a/vcl/unx/generic/dtrans/X11_clipboard.cxx
+++ b/vcl/unx/generic/dtrans/X11_clipboard.cxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/datatransfer/clipboard/RenderingCapabilities.hpp>
 #include <cppuhelper/supportsservice.hxx>
 #include <rtl/ref.hxx>
+#include <sal/log.hxx>
 
 #if OSL_DEBUG_LEVEL > 1
 #include <stdio.h>
@@ -47,7 +48,8 @@ X11Clipboard::X11Clipboard( SelectionManager& rManager, Atom aSelection ) :
         m_aSelection( aSelection )
 {
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "creating instance of X11Clipboard (this=%p)\n", this );
+    SAL_INFO("vcl.unx.dtrans", "creating instance of X11Clipboard (this="
+            << this << ").");
 #endif
 }
 
@@ -72,8 +74,13 @@ X11Clipboard::~X11Clipboard()
     MutexGuard aGuard( *Mutex::getGlobalMutex() );
 
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "shutting down instance of X11Clipboard (this=%p, Selection=\"%s\")\n", this, OUStringToOString( m_xSelectionManager->getString( m_aSelection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+    SAL_INFO("vcl.unx.dtrans", "shutting down instance of X11Clipboard (this="
+            << this
+            << ", Selection=\""
+            << m_xSelectionManager->getString( m_aSelection )
+            << "\").");
 #endif
+
     if( m_aSelection != None )
         m_xSelectionManager->deregisterHandler( m_aSelection );
     else
@@ -87,8 +94,9 @@ void X11Clipboard::fireChangedContentsEvent()
 {
     ClearableMutexGuard aGuard( m_xSelectionManager->getMutex() );
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "X11Clipboard::fireChangedContentsEvent for %s (%" SAL_PRI_SIZET "u listeners)\n",
-             OUStringToOString( m_xSelectionManager->getString( m_aSelection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(), m_aListeners.size() );
+    SAL_INFO("vcl.unx.dtrans", "X11Clipboard::fireChangedContentsEvent for "
+            << m_xSelectionManager->getString( m_aSelection )
+            << " (" << m_aListeners.size() << " listeners).");
 #endif
     ::std::vector< Reference< XClipboardListener > > listeners( m_aListeners );
     aGuard.clear();
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index c98df363daec..11cc3a921bcf 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -199,8 +199,9 @@ rtl_TextEncoding x11::getTextPlainEncoding( const OUString& rMimeType )
         }
     }
 #if OSL_DEBUG_LEVEL > 1
-    if( aEncoding == RTL_TEXTENCODING_DONTKNOW )
-        fprintf( stderr, "getTextPlainEncoding( %s ) failed\n", OUStringToOString( rMimeType, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+    SAL_WARN_IF(aEncoding == RTL_TEXTENCODING_DONTKNOW,
+            "vcl.unx.dtrans", "getTextPlainEncoding( "
+            << rMimeType << " ) failed.");
 #endif
     return aEncoding;
 }
@@ -438,13 +439,14 @@ void SelectionManager::initialize( const Sequence< Any >& arguments )
                     osl_resumeThread( m_aThread );
 #if OSL_DEBUG_LEVEL > 1
                 else
-                    fprintf( stderr, "SelectionManager::initialize: creation of dispatch thread failed !\n" );
+                    SAL_WARN("vcl.unx.dtrans", "SelectionManager::initialize: "
+                            << "creation of dispatch thread failed !.");
 #endif
 
                 if (pipe(m_EndThreadPipe) != 0) {
-                    #if OSL_DEBUG_LEVEL > 1
-                    fprintf(stderr, "Failed to create endThreadPipe\n");
-                    #endif
+#if OSL_DEBUG_LEVEL > 1
+                    SAL_WARN("vcl.unx.dtrans", "Failed to create endThreadPipe.");
+#endif
                     m_EndThreadPipe[0] = m_EndThreadPipe[1] = 0;
                 }
             }
@@ -455,7 +457,9 @@ void SelectionManager::initialize( const Sequence< Any >& arguments )
 SelectionManager::~SelectionManager()
 {
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "SelectionManager::~SelectionManager (%s)\n", m_pDisplay ? DisplayString(m_pDisplay) : "no display" );
+    SAL_INFO("vcl.unx.dtrans", "SelectionManager::~SelectionManager ("
+            << (m_pDisplay ? DisplayString(m_pDisplay) : "no display")
+            << ").");
 #endif
     {
         osl::MutexGuard aGuard( *osl::Mutex::getGlobalMutex() );
@@ -484,7 +488,7 @@ SelectionManager::~SelectionManager()
     osl::MutexGuard aGuard(m_aMutex);
 
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "shutting down SelectionManager\n" );
+    SAL_INFO("vcl.unx.dtrans", "shutting down SelectionManager.");
 #endif
 
     if( m_pDisplay )
@@ -725,11 +729,14 @@ bool SelectionManager::requestOwnership( Atom selection )
             XSetSelectionOwner( m_pDisplay, selection, m_aWindow, CurrentTime );
             if( XGetSelectionOwner( m_pDisplay, selection ) == m_aWindow )
                 bSuccess = true;
+
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "%s ownership for selection %s\n",
-                     bSuccess ? "acquired" : "failed to acquire",
-                     OUStringToOString( getString( selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+            SAL_INFO("vcl.unx.dtrans",
+                    (bSuccess ? "acquired" : "failed to acquire")
+                    << " ownership for selection "
+                    << getString( selection ));
 #endif
+
             Selection* pSel = m_aSelections[ selection ];
             pSel->m_bOwner = bSuccess;
             delete pSel->m_pPixmap;
@@ -738,15 +745,15 @@ bool SelectionManager::requestOwnership( Atom selection )
         }
 #if OSL_DEBUG_LEVEL > 1
         else
-            fprintf( stderr, "no adaptor for selection %s\n",
-                     OUStringToOString( getString( selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+            SAL_WARN("vcl.unx.dtrans", "no adaptor for selection "
+                    << getString( selection ));
 
         if( pAdaptor->getTransferable().is() )
         {
             Sequence< DataFlavor > aTypes = pAdaptor->getTransferable()->getTransferDataFlavors();
             for( int i = 0; i < aTypes.getLength(); i++ )
             {
-                fprintf( stderr, "   %s\n", OUStringToOString( aTypes.getConstArray()[i].MimeType, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+                SAL_INFO("vcl.unx.dtrans", "   " << aTypes.getConstArray()[i].MimeType);
             }
         }
 #endif
@@ -849,12 +856,8 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_In
     bool bSuccess = false;
 
 #if OSL_DEBUG_LEVEL > 1
-    OUString aSelection( getString( selection ) );
-    OUString aType( getString( type ) );
-    fprintf( stderr, "getPasteData( %s, native: %s )\n",
-             OUStringToOString( aSelection, RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-             OUStringToOString( aType, RTL_TEXTENCODING_ISO_8859_1 ).getStr()
-             );
+    SAL_INFO("vcl.unx.dtrans", "getPasteData( " << getString( selection )
+            << ", native: " << getString( type ) << " ).");
 #endif
 
     if( ! m_pDisplay )
@@ -871,7 +874,7 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_In
     {
         // probably bad timing led us here
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "Innere Nabelschau\n" );
+        SAL_WARN("vcl.unx.dtrans", "Innere Nabelschau.");
 #endif
         return false;
     }
@@ -959,9 +962,10 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_In
     } while( ! it->second->m_aDataArrived.check() && (tv_current.tv_sec - tv_last.tv_sec) < getSelectionTimeout() );
 
 #if OSL_DEBUG_LEVEL > 1
-    if( (tv_current.tv_sec - tv_last.tv_sec) > getSelectionTimeout() )
-        fprintf( stderr, "timed out\n" );
+    SAL_WARN_IF((tv_current.tv_sec - tv_last.tv_sec) > getSelectionTimeout(),
+            "vcl.unx.dtrans", "timed out.");
 #endif
+
     if( it->second->m_aDataArrived.check() &&
         it->second->m_aData.getLength() )
     {
@@ -970,7 +974,7 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_In
     }
 #if OSL_DEBUG_LEVEL > 1
     else
-        fprintf( stderr, "conversion unsuccessful\n" );
+        SAL_WARN("vcl.unx.dtrans", "conversion unsuccessful.");
 #endif
     return bSuccess;
 }
@@ -998,10 +1002,12 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ
 
     const Sequence< DataFlavor >& rTypes( it->second->m_aTypes );
     const std::vector< Atom >& rNativeTypes( it->second->m_aNativeTypes );
+
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "getPasteData( \"%s\", \"%s\" )\n",
-             OUStringToOString( getString( selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-             OUStringToOString( rType, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+    SAL_INFO("vcl.unx.dtrans", "getPasteData( \""
+            << getString( selection )
+            << "\", \""
+            << rType << "\" ).");
 #endif
 
     if( rType == "text/plain;charset=utf-16" )
@@ -1043,11 +1049,13 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ
                         )
                     {
 #if OSL_DEBUG_LEVEL > 1
-                        fprintf( stderr, "using \"%s\" instead of \"%s\"\n",
-                                 OUStringToOString( rTypes.getConstArray()[i].MimeType, RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-                                 OUStringToOString( rType, RTL_TEXTENCODING_ISO_8859_1 ).getStr()
-                                 );
+                        SAL_INFO("vcl.unx.dtrans", "using \""
+                                << rTypes.getConstArray()[i].MimeType
+                                << "\" instead of \""
+                                << rType
+                                << "\".");
 #endif
+
                         OString aConvert( reinterpret_cast<char const *>(aData.getConstArray()), aData.getLength() );
                         OUString aUTF( OStringToOUString( aConvert, aEncoding ) );
                         rData = Sequence< sal_Int8 >( reinterpret_cast<sal_Int8 const *>(aUTF.getStr()), (aUTF.getLength()+1)*sizeof( sal_Unicode ) );
@@ -1063,10 +1071,10 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ
         // #i83376# try if someone has the data in image/bmp already before
         // doing the PIXMAP stuff (e.g. the Gimp has this)
         bSuccess = getPasteData( selection, m_nImageBmpAtom, rData );
-        #if OSL_DEBUG_LEVEL > 1
-        if( bSuccess )
-            fprintf( stderr, "got %d bytes of image/bmp\n", (int)rData.getLength() );
-        #endif
+#if OSL_DEBUG_LEVEL > 1
+        SAL_INFO_IF(bSuccess, "vcl.unx.dtrans",
+                "got " << (int) rData.getLength() << " bytes of image/bmp.");
+#endif
         if( ! bSuccess )
         {
             Pixmap aPixmap = None;
@@ -1119,12 +1127,17 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ
                             }
                         }
                     }
-                    #if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 1
                     else
                     {
-                        fprintf( stderr, "could not get PIXMAP property: type=%s, format=%d, items=%ld, bytes=%ld, ret=0x%p\n", OUStringToOString( getString( type ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(), format, nItems, nBytes, pReturn );
+                        SAL_WARN("vcl.unx.dtrans", "could not get PIXMAP property: type="
+                                << getString( type )
+                                << ", format=" << format
+                                << ", items=" << nItems
+                                << ", bytes=" << nBytes
+                                << ", ret=0x" << pReturn);
                     }
-                    #endif
+#endif
                 }
             }
 
@@ -1180,12 +1193,14 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ
             bSuccess = getPasteData( selection, nSelectedType, rData );
     }
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "getPasteData for selection %s and data type %s returns %s, returned sequence has length %" SAL_PRIdINT32 "\n",
-             OUStringToOString( getString( selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-             OUStringToOString( rType, RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-             bSuccess ? "true" : "false",
-             rData.getLength()
-             );
+    SAL_INFO("vcl.unx.dtrans", "getPasteData for selection "
+            << getString( selection )
+            << " and data type "
+            << rType
+            << " returns "
+            << ( bSuccess ? "true" : "false")
+            << ", returned sequence has length "
+            << rData.getLength() <<  ".");
 #endif
     return bSuccess;
 }
@@ -1236,7 +1251,9 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
                                     XA_ATOM,
                                     &nType, &nFormat, &nItems, &nBytes, &pBytes );
 #if OSL_DEBUG_LEVEL > 1
-                fprintf( stderr, "have %ld data types in XdndTypeList\n", nItems );
+                SAL_INFO("vcl.unx.dtrans", "have "
+                        << nItems
+                        << " data types in XdndTypeList.");
 #endif
                 if( nItems == atomcount && nBytes > 0 )
                 {
@@ -1269,7 +1286,9 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
                     if( m_aDropEnterEvent.data.l[2+i] )
                         n++;
 #if OSL_DEBUG_LEVEL > 1
-                fprintf( stderr, "have %d data types in XdndEnter\n", n );
+                SAL_INFO("vcl.unx.dtrans", "have "
+                        << n
+                        << " data types in XdndEnter.");
 #endif
                 aAtoms.realloc( sizeof(Atom)*n );
                 for( i = 0, n = 0; i < 3; i++ )
@@ -1382,9 +1401,12 @@ bool SelectionManager::getPasteDataTypes( Atom selection, Sequence< DataFlavor >
 
 #if OSL_DEBUG_LEVEL > 1
     {
-        fprintf( stderr, "SelectionManager::getPasteDataTypes( %s ) = %s\n", OUStringToOString( getString( selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(), bSuccess ? "true" : "false" );
+        SAL_INFO("vcl.unx.dtrans", "SelectionManager::getPasteDataTypes( "
+                << getString( selection )
+                << " ) = "
+                << (bSuccess ? "true" : "false"));
         for( int i = 0; i < rTypes.getLength(); i++ )
-            fprintf( stderr, "type: %s\n", OUStringToOString( rTypes.getConstArray()[i].MimeType, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+            SAL_INFO("vcl.unx.dtrans", "type: " << rTypes.getConstArray()[i].MimeType);
     }
 #endif
 
@@ -1494,7 +1516,7 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
         if( aData.getLength() > m_nIncrementalThreshold )
         {
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "using INCR protocol\n" );
+            SAL_INFO("vcl.unx.dtrans", "using INCR protocol.");
             std::unordered_map< ::Window, std::unordered_map< Atom, IncrementalTransfer > >::const_iterator win_it = m_aIncrementals.find( requestor );
             if( win_it != m_aIncrementals.end() )
             {
@@ -1502,11 +1524,13 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
                 if( inc_it != win_it->second.end() )
                 {
                     const IncrementalTransfer& rInc = inc_it->second;
-                    fprintf( stderr, "premature end and new start for INCR transfer for window 0x%lx, property %s, type %s\n",
-                             rInc.m_aRequestor,
-                             OUStringToOString( getString( rInc.m_aProperty ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-                             OUStringToOString( getString( rInc.m_aTarget ), RTL_TEXTENCODING_ISO_8859_1 ).getStr()
-                             );
+                    SAL_INFO("vcl.unx.dtrans", "premature end and new start for INCR transfer for window "
+                            << std::showbase << std::hex
+                            << rInc.m_aRequestor
+                            << ", property "
+                            << getString( rInc.m_aProperty )
+                            << ", type "
+                            << getString( rInc.m_aTarget ));
                 }
             }
 #endif
@@ -1543,8 +1567,8 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
     }
 #if OSL_DEBUG_LEVEL > 1
     else
-        fprintf( stderr, "convertData failed for type: %s \n",
-                 OUStringToOString( convertTypeFromNative( target, selection, nFormat ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+        SAL_WARN("vcl.unx.dtrans", "convertData failed for type: "
+                << convertTypeFromNative( target, selection, nFormat ));
 #endif
     return bConverted;
 }
@@ -1552,11 +1576,12 @@ bool SelectionManager::sendData( SelectionAdaptor* pAdaptor,
 bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest )
 {
     osl::ResettableMutexGuard aGuard( m_aMutex );
+
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "handleSelectionRequest for selection %s and target %s\n",
-             OUStringToOString( getString( rRequest.selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-             OUStringToOString( getString( rRequest.target ), RTL_TEXTENCODING_ISO_8859_1 ).getStr()
-             );
+    SAL_INFO("vcl.unx.dtrans", "handleSelectionRequest for selection "
+            << getString( rRequest.selection )
+            << " and target "
+            << getString( rRequest.target ));
 #endif
 
     XEvent aNotify;
@@ -1597,9 +1622,11 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest
                                  XA_ATOM, 32, PropModeReplace, reinterpret_cast<unsigned char*>(pTypes), nTypes );
                 aNotify.xselection.property = rRequest.property;
 #if OSL_DEBUG_LEVEL > 1
-                fprintf( stderr, "sending type list:\n" );
+                SAL_INFO("vcl.unx.dtrans", "sending type list:");
                 for( int k = 0; k < nTypes; k++ )
-                    fprintf( stderr, "   %s\n", pTypes[k] ? XGetAtomName( m_pDisplay, pTypes[k] ) : "<None>" );
+                    SAL_INFO("vcl.unx.dtrans", "   "
+                            << (pTypes[k] ? XGetAtomName( m_pDisplay, pTypes[k] ) :
+                                "<None>"));
 #endif
             }
         }
@@ -1610,7 +1637,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest
                              XA_INTEGER, 32, PropModeReplace, reinterpret_cast<unsigned char*>(&nTimeStamp), 1 );
             aNotify.xselection.property = rRequest.property;
 #if OSL_DEBUG_LEVEL > 1
-                fprintf( stderr, "sending timestamp: %d\n", (int)nTimeStamp );
+            SAL_INFO("vcl.unx.dtrans", "sending timestamp: " << (int)nTimeStamp);
 #endif
         }
         else
@@ -1653,7 +1680,9 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest
                     if( pData && nItems )
                     {
 #if OSL_DEBUG_LEVEL > 1
-                        fprintf( stderr, "found %ld atoms in MULTIPLE request\n", nItems );
+                        SAL_INFO("vcl.unx.dtrans", "found "
+                                << nItems
+                                << " atoms in MULTIPLE request.");
 #endif
                         bEventSuccess = true;
                         bool bResetAtoms = false;
@@ -1662,13 +1691,18 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest
                         for( unsigned long i = 0; i < nItems; i += 2 )
                         {
 #if OSL_DEBUG_LEVEL > 1
-                            fprintf( stderr, "   %s => %s: ",
-                                     OUStringToOString( getString( pAtoms[i] ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-                                     OUStringToOString( getString( pAtoms[i+1] ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+                            std::ostringstream oss;
+                            oss << "   "
+                                << getString( pAtoms[i] )
+                                << " => "
+                                << getString( pAtoms[i+1] )
+                                << ": ";
 #endif
+
                             bool bSuccess = sendData( pAdaptor, rRequest.requestor, pAtoms[i], pAtoms[i+1], rRequest.selection );
 #if OSL_DEBUG_LEVEL > 1
-                            fprintf( stderr, "%s\n", bSuccess ? "succeeded" : "failed" );
+                            oss << (bSuccess ? "succeeded" : "failed");
+                            SAL_INFO("vcl.unx.dtrans", oss.str());
 #endif
                             if( ! bSuccess )
                             {
@@ -1693,19 +1727,25 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest
 #if OSL_DEBUG_LEVEL > 1
                 else
                 {
-                    fprintf( stderr, "could not get type list from \"%s\" of type \"%s\" on requestor 0x%lx, requestor has properties:",
-                             OUStringToOString( getString( rRequest.property ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-                             OUStringToOString( getString( nType ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-                             rRequest.requestor );
+                    std::ostringstream oss;
+                    oss << "could not get type list from \""
+                        << getString( rRequest.property )
+                        << "\" of type \""
+                        << getString( nType )
+                        << "\" on requestor "
+                        << std::showbase << std::hex
+                        << rRequest.requestor
+                        << ", requestor has properties:";
+
                     int nProps = 0;
                     Atom* pProps = XListProperties( m_pDisplay, rRequest.requestor, &nProps );
                     if( pProps )
                     {
                         for( int i = 0; i < nProps; i++ )
-                            fprintf( stderr, " \"%s\"", OUStringToOString( getString( pProps[i]), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+                            oss << " \"" << getString( pProps[i]) << "\"";
                         XFree( pProps );
                     }
-                    fprintf( stderr, "\n" );
+                    SAL_INFO("vcl.unx.dtrans", oss.str());
                 }
 #endif
             }
@@ -1761,8 +1801,8 @@ bool SelectionManager::handleReceivePropertyNotify( XPropertyEvent const & rNoti
     osl::MutexGuard aGuard( m_aMutex );
     // data we requested arrived
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "handleReceivePropertyNotify for property %s\n",
-             OUStringToOString( getString( rNotify.atom ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+    SAL_INFO("vcl.unx.dtrans", "handleReceivePropertyNotify for property "
+             << getString( rNotify.atom ));
 #endif
     bool bHandled = false;
 
@@ -1800,10 +1840,14 @@ bool SelectionManager::handleReceivePropertyNotify( XPropertyEvent const & rNoti
                             &nItems, &nBytes,
                             &pData );
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "found %ld bytes data of type %s and format %d, items = %ld\n",
-                 nBytes,
-                 OUStringToOString( getString( nType ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-                 nFormat, nItems );
+        SAL_INFO("vcl.unx.dtrans", "found "
+                << nBytes
+                << " bytes data of type "
+                << getString( nType )
+                << " and format "
+                << nFormat
+                << ", items = "
+                << nItems);
 #endif
         if( pData )
         {
@@ -1828,11 +1872,17 @@ bool SelectionManager::handleReceivePropertyNotify( XPropertyEvent const & rNoti
                                 &nType, &nFormat,
                                 &nItems, &nBytes,
                                 &pData );
+
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "read %ld items data of type %s and format %d, %ld bytes left in property\n",
-                     nItems,
-                     OUStringToOString( getString( nType ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-                     nFormat, nBytes );
+            SAL_INFO("vcl.unx.dtrans", "read "
+                    << nItems
+                    << " items data of type "
+                    << getString( nType )
+                    << " and format "
+                    << nFormat
+                    << ", "
+                    << nBytes
+                    << " bytes left in property.");
 #endif
 
             std::size_t nUnitSize = GetTrueFormatSize(nFormat);
@@ -1879,10 +1929,15 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent const & rNotify
 
     // ready for next part of an IncrementalTransfer
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "handleSendPropertyNotify for property %s (%s)\n",
-             OUStringToOString( getString( rNotify.atom ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-             rNotify.state == PropertyNewValue ? "new value" : ( rNotify.state == PropertyDelete ? "deleted" : "unknown")
-             );
+    SAL_INFO("vcl.unx.dtrans", "handleSendPropertyNotify for property "
+            << getString( rNotify.atom )
+            << " ("
+            << (rNotify.state == PropertyNewValue ?
+                "new value" :
+                (rNotify.state == PropertyDelete ?
+                  "deleted" :
+                  "unknown"))
+            << ").");
 #endif
 
     bool bHandled = false;
@@ -1903,11 +1958,14 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent const & rNotify
                     aTimeouts.push_back( incrementalTransfer.first );
 #if OSL_DEBUG_LEVEL > 1
                     const IncrementalTransfer& rInc = incrementalTransfer.second;
-                    fprintf( stderr, "timeout on INCR transfer for window 0x%lx, property %s, type %s\n",
-                             rInc.m_aRequestor,
-                             OUStringToOString( getString( rInc.m_aProperty ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-                             OUStringToOString( getString( rInc.m_aTarget ), RTL_TEXTENCODING_ISO_8859_1 ).getStr()
-                             );
+                    SAL_INFO("vcl.unx.dtrans",
+                            "timeout on INCR transfer for window "
+                            << std::showbase << std::hex
+                            << rInc.m_aRequestor
+                            << ", property "
+                            << getString( rInc.m_aProperty )
+                            << ", type "
+                            << getString( rInc.m_aTarget ));
 #endif
                 }
             }
@@ -1930,11 +1988,14 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent const & rNotify
                 if( nBytes < 0 )  // sanity check
                     nBytes = 0;
 #if OSL_DEBUG_LEVEL > 1
-                fprintf( stderr, "pushing %d bytes: \"%.*s\"...\n",
-                         nBytes, std::min(nBytes, 32),
-                         (const unsigned char*)rInc.m_aData.getConstArray()+rInc.m_nBufferPos );
+                SAL_INFO("vcl.unx.dtrans", "pushing "
+                        << nBytes
+                        << " bytes: \""
+                        << std::setw(std::min(nBytes, 32))
+                        << ((const unsigned char*)
+                            rInc.m_aData.getConstArray()+rInc.m_nBufferPos)
+                        << "\"...");
 #endif
-
                 std::size_t nUnitSize = GetTrueFormatSize(rInc.m_nFormat);
 
                 XChangeProperty( m_pDisplay,
@@ -1951,11 +2012,14 @@ bool SelectionManager::handleSendPropertyNotify( XPropertyEvent const & rNotify
                 if( nBytes == 0 ) // transfer finished
                 {
 #if OSL_DEBUG_LEVEL > 1
-                    fprintf( stderr, "finished INCR transfer for window 0x%lx, property %s, type %s\n",
-                             rInc.m_aRequestor,
-                             OUStringToOString( getString( rInc.m_aProperty ), RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-                             OUStringToOString( getString( rInc.m_aTarget ), RTL_TEXTENCODING_ISO_8859_1 ).getStr()
-                             );
+                    SAL_INFO("vcl.unx.dtrans", "finished INCR transfer for "
+                            << "window "
+                            << std::showbase << std::hex
+                            << rInc.m_aRequestor
+                            << ", property "
+                            << getString( rInc.m_aProperty )
+                            << ", type "
+                            << getString( rInc.m_aTarget ));
 #endif
                     it->second.erase( inc_it );
                 }
@@ -1977,17 +2041,19 @@ bool SelectionManager::handleSelectionNotify( XSelectionEvent const & rNotify )
 
     // notification about success/failure of one of our conversion requests
 #if OSL_DEBUG_LEVEL > 1
-    OUString aSelection( getString( rNotify.selection ) );
-    OUString aProperty("None");
-    if( rNotify.property )
-        aProperty = getString( rNotify.property );
-    fprintf( stderr, "handleSelectionNotify for selection %s and property %s (0x%lx)\n",
-             OUStringToOString( aSelection, RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-             OUStringToOString( aProperty, RTL_TEXTENCODING_ISO_8859_1 ).getStr(),
-             rNotify.property
-             );
-    if( rNotify.requestor != m_aWindow && rNotify.requestor != m_aCurrentDropWindow )
-        fprintf( stderr, "Warning: selection notify for unknown window 0x%lx\n", rNotify.requestor );
+    SAL_INFO("vcl.unx.dtrans", "handleSelectionNotify for selection "
+            << getString( rNotify.selection )
+            << " and property "
+            << (rNotify.property ? getString( rNotify.property ) : "None")
+            << " ("
+            << std::showbase << std::hex
+            << rNotify.property
+            << ").");
+    SAL_WARN_IF(rNotify.requestor != m_aWindow &&
+            rNotify.requestor != m_aCurrentDropWindow,
+            "vcl.unx.dtrans", "selection notify for unknown window "
+            << std::showbase << std::hex
+            << rNotify.requestor);
 #endif
     std::unordered_map< Atom, Selection* >::iterator it =
           m_aSelections.find( rNotify.selection );
@@ -2055,7 +2121,7 @@ bool SelectionManager::handleSelectionNotify( XSelectionEvent const & rNotify )
     }
 #if OSL_DEBUG_LEVEL > 1
     else if( it != m_aSelections.end() )
-        fprintf( stderr, "Warning: selection in state %d\n", it->second->m_eState );
+        SAL_WARN("vcl.unx.dtrans", "selection in state " << it->second->m_eState);
 #endif
     return bHandled;
 }
@@ -2079,15 +2145,25 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent const & rMessage )
         rMessage.message_type == m_nXdndDrop      ||
         rMessage.message_type == m_nXdndPosition  )
     {
-        fprintf( stderr, "got drop event %s, ", OUStringToOString( getString( rMessage.message_type ), RTL_TEXTENCODING_ASCII_US).getStr() );
+        std::ostringstream oss;
+        oss << "got drop event "
+            << getString( rMessage.message_type )
+            << ", ";
+
         if( it == m_aDropTargets.end() )
-            fprintf( stderr, "but no target found\n" );
+            oss << "but no target found.";
         else if( ! it->second.m_pTarget->m_bActive )
-            fprintf( stderr, "but target is inactive\n" );
+            oss << "but target is inactive.";
         else if( m_aDropEnterEvent.data.l[0] != None && (::Window)m_aDropEnterEvent.data.l[0] != aSource )
-            fprintf( stderr, "but source 0x%lx is unknown (expected 0x%lx or 0)\n", aSource, m_aDropEnterEvent.data.l[0] );
+            oss << "but source "
+                << std::showbase << std::hex
+                << aSource
+                << " is unknown (expected "
+                << m_aDropEnterEvent.data.l[0]
+                << " or 0).";
         else
-            fprintf( stderr, "processing.\n" );
+            oss << "processing.";
+        SAL_INFO("vcl.unx.dtrans", oss.str());
     }
 #endif
 
@@ -2116,7 +2192,9 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent const & rMessage )
             m_aCurrentDropWindow        = aTarget;
             m_nCurrentProtocolVersion   = m_aDropEnterEvent.data.l[1] >> 24;
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "received XdndEnter on 0x%lx\n", aTarget );
+            SAL_INFO("vcl.unx.dtrans", "received XdndEnter on "
+                    << std::showbase << std::hex
+                    << aTarget);
 #endif
         }
         else if(
@@ -2135,9 +2213,16 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent const & rMessage )
                                    rMessage.data.l[2] & 0xffff,
                                    &m_nLastX, &m_nLastY,
                                    &aChild );
-
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "received XdndPosition on 0x%lx (%d, %d)\n", aTarget, m_nLastX, m_nLastY );
+            SAL_INFO("vcl.unx.dtrans", "received XdndPosition on "
+                    << std::showbase << std::hex
+                    << aTarget
+                    << " ("
+                    << std::dec
+                    << m_nLastX
+                    << ", "
+                    << m_nLastY
+                    << ").");
 #endif
             DropTargetDragEnterEvent aEvent;
             aEvent.Source       = static_cast< XDropTarget* >(it->second.m_pTarget);
@@ -2180,7 +2265,9 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent const & rMessage )
         {
             bHandled = true;
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "received XdndLeave on 0x%lx\n", aTarget );
+            SAL_INFO("vcl.unx.dtrans", "received XdndLeave on "
+                    << std::showbase << std::hex
+                    << aTarget);
 #endif
             DropTargetEvent aEvent;
             aEvent.Source = static_cast< XDropTarget* >(it->second.m_pTarget);
@@ -2198,9 +2285,15 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent const & rMessage )
         {
             bHandled = true;
             m_nDropTime = m_nCurrentProtocolVersion > 0 ? rMessage.data.l[2] : CurrentTime;
-
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "received XdndDrop on 0x%lx (%d, %d)\n", aTarget, m_nLastX, m_nLastY );
+            SAL_INFO("vcl.unx.dtrans", "received XdndDrop on "
+                    << std::showbase << std::hex
+                    << aTarget
+                    << " ("
+                    << m_nLastX
+                    << ", "
+                    << m_nLastY
+                    << ").");
 #endif
             if( m_bLastDropAccepted )
             {
@@ -2222,7 +2315,8 @@ bool SelectionManager::handleDropEvent( XClientMessageEvent const & rMessage )
             else
             {
 #if OSL_DEBUG_LEVEL > 1
-                fprintf( stderr, "XdndDrop canceled due to m_bLastDropAccepted = false\n" );
+                SAL_INFO("vcl.unx.dtrans", "XdndDrop canceled due to "
+                        << "m_bLastDropAccepted = false." );
 #endif
                 DropTargetEvent aEvent;
                 aEvent.Source = static_cast< XDropTarget* >(it->second.m_pTarget);
@@ -2282,13 +2376,11 @@ void SelectionManager::dropComplete( bool bSuccess, ::Window aDropWindow )
                 else if( m_nLastDropAction & DNDConstants::ACTION_LINK )
                     aEvent.xclient.data.l[2] = m_nXdndActionLink;
             }
-
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "Sending XdndFinished to 0x%lx\n",
-                     m_aDropEnterEvent.data.l[0]
-                     );
+            SAL_INFO("vcl.unx.dtrans", "Sending XdndFinished to "
+                    << std::showbase << std::hex
+                    << m_aDropEnterEvent.data.l[0]);
 #endif
-
             XSendEvent( m_pDisplay, m_aDropEnterEvent.data.l[0],
                         False, NoEventMask, & aEvent );
 
@@ -2361,10 +2453,11 @@ void SelectionManager::sendDragStatus( Atom nDropAction )
         aEvent.xclient.data.l[4] = m_nCurrentProtocolVersion > 1 ? nDropAction : 0;
 
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "Sending XdndStatus to 0x%lx with action %s\n",
-                 m_aDropEnterEvent.data.l[0],
-                 OUStringToOString( getString( nDropAction ), RTL_TEXTENCODING_ISO_8859_1 ).getStr()
-                 );
+        SAL_INFO("vcl.unx.dtrans", "Sending XdndStatus to "
+                << std::showbase << std::hex
+                << m_aDropEnterEvent.data.l[0]
+                << " with action "
+                << getString( nDropAction ));
 #endif
 
         XSendEvent( m_pDisplay, m_aDropEnterEvent.data.l[0],
@@ -2412,7 +2505,11 @@ bool SelectionManager::updateDragAction( int modifierState )
     if( nNewDropAction != m_nUserDragAction || m_nTargetAcceptAction != DNDConstants::ACTION_DEFAULT )
     {
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "updateDragAction: %x -> %x\n", (int)m_nUserDragAction, (int)nNewDropAction );
+        SAL_INFO("vcl.unx.dtrans", "updateDragAction: "
+                << std::hex
+                << (int)m_nUserDragAction
+                << " -> "
+                << (int)nNewDropAction);
 #endif
         bRet = true;
         m_nUserDragAction = nNewDropAction;
@@ -2499,34 +2596,46 @@ bool SelectionManager::handleDragEvent( XEvent const & rMessage )
     // for shortcut
     std::unordered_map< ::Window, DropTargetEntry >::const_iterator it =
           m_aDropTargets.find( m_aDropWindow );
+
 #if OSL_DEBUG_LEVEL > 1
     switch( rMessage.type )
     {
         case ClientMessage:
-            fprintf( stderr, "handleDragEvent: %s\n", OUStringToOString( getString( rMessage.xclient.message_type ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+            SAL_INFO("vcl.unx.dtrans", "handleDragEvent: "
+                    << getString( rMessage.xclient.message_type ));
             break;
         case MotionNotify:
             break;
         case EnterNotify:
-            fprintf( stderr, "handleDragEvent: EnterNotify\n" );
+            SAL_INFO("vcl.unx.dtrans", "handleDragEvent: EnterNotify.");
             break;
         case LeaveNotify:
-            fprintf( stderr, "handleDragEvent: LeaveNotify\n" );
+            SAL_INFO("vcl.unx.dtrans", "handleDragEvent: LeaveNotify.");
             break;
         case ButtonPress:
-            fprintf( stderr, "handleDragEvent: ButtonPress %d (m_nDragButton = %d)\n", rMessage.xbutton.button, m_nDragButton );
+            SAL_INFO("vcl.unx.dtrans", "handleDragEvent: ButtonPress "
+                    << rMessage.xbutton.button
+                    << " (m_nDragButton = "
+                    << m_nDragButton
+                    << ").");
             break;
         case ButtonRelease:
-            fprintf( stderr, "handleDragEvent: ButtonRelease %d (m_nDragButton = %d)\n", rMessage.xbutton.button, m_nDragButton );
+            SAL_INFO("vcl.unx.dtrans", "handleDragEvent: ButtonRelease "
+                    << rMessage.xbutton.button
+                    << " (m_nDragButton = "
+                    << m_nDragButton
+                    << ").");
             break;
         case KeyPress:
-            fprintf( stderr, "handleDragEvent: KeyPress\n" );
+            SAL_INFO("vcl.unx.dtrans", "handleDragEvent: KeyPress.");
             break;
         case KeyRelease:
-            fprintf( stderr, "handleDragEvent: KeyRelease\n" );
+            SAL_INFO("vcl.unx.dtrans", "handleDragEvent: KeyRelease.");
             break;
         default:
-            fprintf( stderr, "handleDragEvent: <unknown type %d>\n", rMessage.type );
+            SAL_INFO("vcl.unx.dtrans", "handleDragEvent: <unknown type "
+                    << rMessage.type
+                    << ">.");
             break;
     }
 #endif
@@ -2545,9 +2654,10 @@ bool SelectionManager::handleDragEvent( XEvent const & rMessage )
             dsde.DropAction = DNDConstants::ACTION_NONE;
             m_bDropSuccess = (rMessage.xclient.data.l[1] & 1) != 0;
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "status drop action: accept = %s, %s\n",
-                     m_bDropSuccess ? "true" : "false",
-                     OUStringToOString( getString( rMessage.xclient.data.l[4] ), RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
+            SAL_INFO("vcl.unx.dtrans", "status drop action: accept = "
+                    << (m_bDropSuccess ? "true" : "false")
+                    << ", "
+                    << getString( rMessage.xclient.data.l[4] ));
 #endif
             if( rMessage.xclient.data.l[1] & 1 )
             {
@@ -2810,7 +2920,7 @@ void SelectionManager::accept( sal_Int8 dragOperation, ::Window aDropWindow )
     if( aDropWindow == m_aCurrentDropWindow )
     {
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "accept: %x\n", dragOperation );
+        SAL_INFO("vcl.unx.dtrans", "accept: " << std::hex << dragOperation);
 #endif
         Atom nAction = None;
         dragOperation &= (DNDConstants::ACTION_MOVE | DNDConstants::ACTION_COPY | DNDConstants::ACTION_LINK);
@@ -2830,7 +2940,7 @@ void SelectionManager::reject( ::Window aDropWindow )
     if( aDropWindow == m_aCurrentDropWindow )
     {
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "reject\n" );
+        SAL_INFO("vcl.unx.dtrans", "reject.");
 #endif
         m_bLastDropAccepted = false;
         sendDragStatus( None );
@@ -2993,9 +3103,20 @@ void SelectionManager::updateDragWindow( int nX, int nY, ::Window aRoot )
     if( aNewCurrentWindow != m_aDropWindow )
     {
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "drag left window 0x%lx (rev. %d), entered window 0x%lx (rev %d)\n", m_aDropWindow, m_nCurrentProtocolVersion, aNewCurrentWindow, nNewProtocolVersion );
+        SAL_INFO("vcl.unx.dtrans", "drag left window "
+                << std::showbase << std::hex
+                << m_aDropWindow
+                << std::dec
+                << " (rev. "
+                << m_nCurrentProtocolVersion
+                << "), entered window "
+                << std::showbase << std::hex
+                << aNewCurrentWindow
+                << " (rev "
+                << std::dec
+                << nNewProtocolVersion
+                << ").");
 #endif
-
         if( m_aDropWindow != None )
         {
             it = m_aDropTargets.find( m_aDropWindow );
@@ -3104,9 +3225,11 @@ void SelectionManager::startDrag(
                                  )
 {
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "startDrag( sourceActions = %x )\n", (int)sourceActions );
+    SAL_INFO("vcl.unx.dtrans", "startDrag( sourceActions = "
+            << std::hex
+            << (int)sourceActions
+            << " ).");
 #endif
-
     DragSourceDropEvent aDragFailedEvent;
     aDragFailedEvent.Source             = static_cast< OWeakObject* >(this);
     aDragFailedEvent.DragSource         = static_cast< XDragSource* >(this);
@@ -3120,11 +3243,14 @@ void SelectionManager::startDrag(
             listener->dragDropEnd( aDragFailedEvent );
 
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "*** ERROR *** second drag and drop started.\n" );
+        SAL_WARN("vcl.unx.dtrans",
+                "*** ERROR *** second drag and drop started.");
         if( m_xDragSourceListener.is() )
-            fprintf( stderr, "*** ERROR *** drag source listener already set.\n" );
+            SAL_WARN("vcl.unx.dtrans",
+                    "*** ERROR *** drag source listener already set.");
         else
-            fprintf( stderr, "*** ERROR *** drag thread already running.\n" );
+            SAL_WARN("vcl.unx.dtrans",
+                    "*** ERROR *** drag thread already running.");
 #endif
         return;
     }
@@ -3180,7 +3306,9 @@ void SelectionManager::startDrag(
             {
                 m_aDragSourceWindow = aChild;
 #if OSL_DEBUG_LEVEL > 1
-                fprintf( stderr, "found drag source window 0x%lx\n", m_aDragSourceWindow );
+                SAL_INFO("vcl.unx.dtrans", "found drag source window "
+                        << std::showbase << std::hex
+                        << m_aDragSourceWindow);
 #endif
                 break;
             }
@@ -3188,7 +3316,7 @@ void SelectionManager::startDrag(
         } while( aChild != None );
 
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "try to grab pointer ... " );
+        SAL_INFO("vcl.unx.dtrans", "try to grab pointer ...");
 #endif
         int nPointerGrabSuccess =
             XGrabPointer( m_pDisplay, aRoot, True,
@@ -3224,16 +3352,16 @@ void SelectionManager::startDrag(
             }
         }
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "%d\n", nPointerGrabSuccess );
-#endif
-#if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "try to grab keyboard ... " );
+        SAL_INFO("vcl.unx.dtrans", "... grabbed pointer: "
+                << nPointerGrabSuccess);
+        SAL_INFO("vcl.unx.dtrans", "try to grab keyboard ...");
 #endif
         int nKeyboardGrabSuccess =
             XGrabKeyboard( m_pDisplay, aRoot, True,
                            GrabModeAsync, GrabModeAsync, CurrentTime );
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "%d\n", nKeyboardGrabSuccess );
+        SAL_INFO("vcl.unx.dtrans", "... grabbed keyboard: "
+                << nKeyboardGrabSuccess);
 #endif
         if( nPointerGrabSuccess != GrabSuccess || nKeyboardGrabSuccess != GrabSuccess )
         {
@@ -3297,7 +3425,9 @@ void SelectionManager::startDrag(
                 m_nDragButton = Button2;
         }
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "m_nUserDragAction = %x\n", (int)m_nUserDragAction );
+        SAL_INFO("vcl.unx.dtrans", "m_nUserDragAction = "
+                << std::hex
+                << (int)m_nUserDragAction);
 #endif
         updateDragWindow( root_x, root_y, aRoot );
         m_nUserDragAction = ~0;
@@ -3311,7 +3441,8 @@ void SelectionManager::startDrag(
     else
     {
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "osl_createSuspendedThread failed for drag execute\n" );
+        SAL_INFO("vcl.unx.dtrans", "osl_createSuspendedThread failed "
+                << "for drag execute.");
 #endif
         m_xDragSourceListener.clear();
         m_xDragSourceTransferable.clear();
@@ -3362,7 +3493,7 @@ void SelectionManager::dragDoDispatch()
     // do drag
     // m_xDragSourceListener will be cleared on finished drop
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "begin executeDrag dispatching\n" );
+    SAL_INFO("vcl.unx.dtrans", "begin executeDrag dispatching.");
 #endif
     oslThread aThread = m_aDragExecuteThread;
     while( m_xDragSourceListener.is() && ( ! m_bDropSent || time(nullptr)-m_nDropTimeout < 5 ) && osl_scheduleThread( aThread ) )
@@ -3372,7 +3503,7 @@ void SelectionManager::dragDoDispatch()
         osl::Thread::wait(std::chrono::milliseconds(200));
     }
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "end executeDrag dispatching\n" );
+    SAL_INFO("vcl.unx.dtrans", "end executeDrag dispatching.");
 #endif
     {
         osl::ClearableMutexGuard aGuard(m_aMutex);
@@ -3522,9 +3653,8 @@ bool SelectionManager::handleXEvent( XEvent& rEvent )
         {
             osl::ClearableMutexGuard aGuard(m_aMutex);
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "SelectionClear for selection %s\n",
-                     OUStringToOString( getString( rEvent.xselectionclear.selection ), RTL_TEXTENCODING_ISO_8859_1 ).getStr()
-                     );
+            SAL_INFO("vcl.unx.dtrans", "SelectionClear for selection "
+                    << getString( rEvent.xselectionclear.selection ));
 #endif
             SelectionAdaptor* pAdaptor = getAdaptor( rEvent.xselectionclear.selection );
             std::unordered_map< Atom, Selection* >::iterator it( m_aSelections.find( rEvent.xselectionclear.selection ) );
@@ -3622,7 +3752,7 @@ void SelectionManager::dispatchEvent( int millisec )
 void SelectionManager::run( void* pThis )
 {
 #if OSL_DEBUG_LEVEL > 1
-    fprintf(stderr, "SelectionManager::run\n" );
+    SAL_INFO("vcl.unx.dtrans", "SelectionManager::run.");
 #endif
     osl::Thread::setName("SelectionManager");
     // dispatch until the cows come home
@@ -3679,15 +3809,15 @@ void SelectionManager::run( void* pThis )
     close(This->m_EndThreadPipe[1]);
     close(This->m_EndThreadPipe[0]);
 #if OSL_DEBUG_LEVEL > 1
-    fprintf(stderr, "SelectionManager::run end\n" );
+    SAL_INFO("vcl.unx.dtrans", "SelectionManager::run end.");
 #endif
 }
 
 void SelectionManager::shutdown() throw()
 {
-    #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "SelectionManager got app termination event\n" );
-    #endif
+#if OSL_DEBUG_LEVEL > 1
+    SAL_INFO("vcl.unx.dtrans", "SelectionManager got app termination event.");
+#endif
 
     osl::ResettableMutexGuard aGuard(m_aMutex);
 
@@ -3768,9 +3898,9 @@ sal_Bool SelectionManager::handleEvent(const Any& event)
     }
     else
     {
-        #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "SelectionManager got downing event\n" );
-        #endif
+#if OSL_DEBUG_LEVEL > 1
+        SAL_INFO("vcl.unx.dtrans", "SelectionManager got downing event.");
+#endif
         shutdown();
     }
     return true;
diff --git a/vcl/unx/generic/dtrans/bmp.cxx b/vcl/unx/generic/dtrans/bmp.cxx
index d7e7d4dc6c0c..7f0111a614e4 100644
--- a/vcl/unx/generic/dtrans/bmp.cxx
+++ b/vcl/unx/generic/dtrans/bmp.cxx
@@ -25,6 +25,7 @@
 #include <vcl/bitmapex.hxx>
 #include <vcl/BitmapSimpleColorQuantizationFilter.hxx>
 
+#include <sal/log.hxx>
 #include <unx/x11/xlimits.hxx>
 
 #include "bmp.hxx"
@@ -366,7 +367,7 @@ PixmapHolder::PixmapHolder( Display* pDisplay )
     if( ! XMatchVisualInfo( m_pDisplay, DefaultScreen( m_pDisplay ), 24, TrueColor, &m_aInfo ) )
     {
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "PixmapHolder reverting to default visual\n" );
+        SAL_INFO("vcl.unx.dtrans", "PixmapHolder reverting to default visual.");
 #endif
         Visual* pVisual     = DefaultVisual( m_pDisplay, DefaultScreen( m_pDisplay ) );
         m_aInfo.screen      = DefaultScreen( m_pDisplay );
@@ -382,12 +383,23 @@ PixmapHolder::PixmapHolder( Display* pDisplay )
 #if OSL_DEBUG_LEVEL > 1
     static const char* pClasses[] =
         { "StaticGray", "GrayScale", "StaticColor", "PseudoColor", "TrueColor", "DirectColor" };
-    fprintf( stderr, "PixmapHolder visual: id = 0x%lx, class = %s (%d), depth=%d; color map = 0x%lx\n",
-             m_aInfo.visualid,
-             (m_aInfo.c_class >= 0 && unsigned(m_aInfo.c_class) < SAL_N_ELEMENTS(pClasses)) ? pClasses[m_aInfo.c_class] : "<unknown>",
-             m_aInfo.c_class,
-             m_aInfo.depth,
-             m_aColormap  );
+    SAL_INFO("vcl.unx.dtrans", "PixmapHolder visual: id = "
+        << std::showbase << std::hex
+        << m_aInfo.visualid
+        << ", class = "
+        << ((m_aInfo.c_class >= 0 &&
+                unsigned(m_aInfo.c_class) <
+                SAL_N_ELEMENTS(pClasses)) ?
+            pClasses[m_aInfo.c_class] :
+            "<unknown>")
+        << " ("
+        << std::dec
+        << m_aInfo.c_class
+        << "), depth="
+        << m_aInfo.depth
+        << "; color map = "
+        << std::showbase << std::hex
+        << m_aColormap);
 #endif
     if( m_aInfo.c_class == TrueColor )
     {
diff --git a/vcl/unx/generic/dtrans/config.cxx b/vcl/unx/generic/dtrans/config.cxx
index 7ee1f18e8138..6b40fc16c5ea 100644
--- a/vcl/unx/generic/dtrans/config.cxx
+++ b/vcl/unx/generic/dtrans/config.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <o3tl/any.hxx>
+#include <sal/log.hxx>
 #include <unotools/configitem.hxx>
 
 #include "X11_selection.hxx"
@@ -58,7 +59,9 @@ sal_Int32 SelectionManager::getSelectionTimeout()
         DtransX11ConfigItem aCfg;
         m_nSelectionTimeout = aCfg.getSelectionTimeout();
 #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "initialized selection timeout to %" SAL_PRIdINT32 " seconds\n", m_nSelectionTimeout );
+        SAL_INFO("vcl.unx.dtrans", "initialized selection timeout to "
+                << m_nSelectionTimeout
+                << " seconds.");
 #endif
     }
     return m_nSelectionTimeout;
@@ -76,7 +79,10 @@ DtransX11ConfigItem::DtransX11ConfigItem() :
     Sequence<OUString> aKeys { SELECTION_PROPERTY };
     const Sequence< Any > aValues = GetProperties( aKeys );
 #if OSL_DEBUG_LEVEL > 1
-    fprintf( stderr, "found %" SAL_PRIdINT32 " properties for %s\n", aValues.getLength(), SELECTION_PROPERTY );
+    SAL_INFO("vcl.unx.dtrans", "found "
+            << aValues.getLength()
+            << " properties for "
+            << SELECTION_PROPERTY);
 #endif
     for( Any const & value : aValues )
     {
@@ -89,14 +95,13 @@ DtransX11ConfigItem::DtransX11ConfigItem() :
                     m_nSelectionTimeout = 1;
             }
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "found SelectionTimeout \"%s\"\n",
-                     OUStringToOString( *pLine, osl_getThreadTextEncoding() ).getStr() );
+            SAL_INFO("vcl.unx.dtrans", "found SelectionTimeout \"" << *pLine << "\".");
 #endif
         }
 #if OSL_DEBUG_LEVEL > 1
         else
-            fprintf( stderr, "found SelectionTimeout of type \"%s\"\n",
-                     OUStringToOString( value.getValueType().getTypeName(), osl_getThreadTextEncoding() ).getStr() );
+            SAL_INFO("vcl.unx.dtrans", "found SelectionTimeout of type \""
+                    << value.getValueType().getTypeName() << "\".");
 #endif
     }
 }
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 821d030c1d24..dea4cd548949 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -659,8 +659,10 @@ void PrintFontManager::addFontconfigDir( const OString& rDirName )
         fclose( pCfgFile);
         bool bCfgOk = FcConfigParseAndLoad(FcConfigGetCurrent(),
                         reinterpret_cast<FcChar8 const *>(aConfFileName.getStr()), FcTrue);
-        if( !bCfgOk )
-            fprintf( stderr, "FcConfigParseAndLoad( \"%s\") => %d\n", aConfFileName.getStr(), bCfgOk );
+
+        SAL_INFO_IF(!bCfgOk,
+                "vcl.fonts", "FcConfigParseAndLoad( \""
+                << aConfFileName << "\") => " << bCfgOk);
     } else {
         SAL_INFO("vcl.fonts", "cannot open " << aConfFileName);
     }
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx
index a7ed0c4e1082..d1601335a1cd 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -680,7 +680,6 @@ void PrintFontManager::initialize()
         m_nNextFontID = 1;
         m_aFonts.clear();
     }
-
 #if OSL_DEBUG_LEVEL > 1
     clock_t aStart;
     clock_t aStep1;
@@ -721,14 +720,18 @@ void PrintFontManager::initialize()
 
 #if OSL_DEBUG_LEVEL > 1
     aStep1 = times( &tms );
-#endif
 
-#if OSL_DEBUG_LEVEL > 1
     aStep2 = times( &tms );
-    fprintf( stderr, "PrintFontManager::initialize: collected %" SAL_PRI_SIZET "u fonts\n", m_aFonts.size() );
+    SAL_INFO("vcl.fonts", "PrintFontManager::initialize: collected "
+            << m_aFonts.size()
+            << " fonts.");
     double fTick = (double)sysconf( _SC_CLK_TCK );
-    fprintf( stderr, "Step 1 took %lf seconds\n", (double)(aStep1 - aStart)/fTick );
-    fprintf( stderr, "Step 2 took %lf seconds\n", (double)(aStep2 - aStep1)/fTick );
+    SAL_INFO("vcl.fonts", "Step 1 took "
+            << ((double)(aStep1 - aStart)/fTick)
+            << " seconds.");
+    SAL_INFO("vcl.fonts", "Step 2 took "
+            << ((double)(aStep2 - aStep1)/fTick)
+            << " seconds.");
 #endif
 
     #ifdef CALLGRIND_COMPILE
diff --git a/vcl/unx/generic/fontmanager/fontsubst.cxx b/vcl/unx/generic/fontmanager/fontsubst.cxx
index 1b8fb5807bee..7e71a96c35e9 100644
--- a/vcl/unx/generic/fontmanager/fontsubst.cxx
+++ b/vcl/unx/generic/fontmanager/fontsubst.cxx
@@ -132,18 +132,26 @@ bool FcPreMatchSubstitution::FindFontSubstitute(FontSelectPattern &rFontSelData)
     const bool bHaveSubstitute = !uselessmatch( rFontSelData, aOut );
 
 #ifdef DEBUG
-    const OString aOrigName(OUStringToOString(rFontSelData.maTargetName,
-        RTL_TEXTENCODING_UTF8));
-    const OString aSubstName(OUStringToOString(aOut.maSearchName,
-        RTL_TEXTENCODING_UTF8));
-    printf( "FcPreMatchSubstitution \"%s\" bipw=%d%d%d%d -> ",
-        aOrigName.getStr(), rFontSelData.GetWeight(), rFontSelData.GetItalic(),
-        rFontSelData.GetPitch(), rFontSelData.GetWidthType() );
+    std::ostringstream oss;
+    oss << "FcPreMatchSubstitution \""
+        << rFontSelData.maTargetName
+        << "\" bipw="
+        << rFontSelData.GetWeight()
+        << rFontSelData.GetItalic()
+        << rFontSelData.GetPitch()
+        << rFontSelData.GetWidthType()
+        << " -> ";
     if( !bHaveSubstitute )
-        printf( "no substitute available\n" );
+        oss << "no substitute available.";
     else
-        printf( "\"%s\" bipw=%d%d%d%d\n", aSubstName.getStr(),
-        aOut.GetWeight(), aOut.GetItalic(), aOut.GetPitch(), aOut.GetWidthType() );
+        oss << "\""
+            << aOut.maSearchName
+            << "\" bipw="
+            << aOut.GetWeight()
+            << aOut.GetItalic()
+            << aOut.GetPitch()
+            << aOut.GetWidthType();
+    SAL_INFO("vcl.fonts", oss.str());
 #endif
 
     if( bHaveSubstitute )
@@ -182,18 +190,26 @@ bool FcGlyphFallbackSubstitution::FindFontSubstitute(FontSelectPattern& rFontSel
     const bool bHaveSubstitute = !uselessmatch( rFontSelData, aOut );
 
 #ifdef DEBUG
-    const OString aOrigName(OUStringToOString(rFontSelData.maTargetName,
-        RTL_TEXTENCODING_UTF8));
-    const OString aSubstName(OUStringToOString(aOut.maSearchName,
-        RTL_TEXTENCODING_UTF8));
-    printf( "FcGFSubstitution \"%s\" bipw=%d%d%d%d ->",

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list