wxLogDebug flush

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

wxLogDebug flush

Post by pvn »

I have been using wxLogDebug on Windows for years, and recently moved to MacOS
one behavior I noticed is that the output is not immediately shown on screen

probably due to buffering , as explained here

https://docs.wxwidgets.org/3.0/classwx_log.html

I need to have an immediate output, how can this be achieved , either with wxLogDebug
or any other wxLog feature

the documentation says

Code: Select all

static void wxLog::FlushActive 	
does the flush, but I could not make it to do so

Code: Select all

wxLogDebug("%s", date_run_.FormatISOCombined().c_str());

wxMessageOutputStderr out;
out.Printf(wxT("%s"), date_run_.FormatISOCombined().c_str());
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxLogDebug flush

Post by ONEEYEMAN »

Hi,
What OSX version you are testing it on?
What is the minimum version you set during configure?

Thank you.
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: wxLogDebug flush

Post by pvn »

I'm using MacOS 10.15.7 Catalina

cmake output is

Code: Select all

cmake .. -DwxBUILD_COMPATIBILITY=3.1 -DwxBUILD_SHARED=OFF 
-- Setting build type to 'Debug' as none was specified.
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- cotire 1.8.0 loaded.
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libz.tbd (found version "1.2.11") 
-- Found EXPAT: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libexpat.tbd (found version "2.2.8") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found Iconv: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libiconv.tbd
-- Found OpenGL: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework   
-- Could NOT find MSPACK (missing: MSPACK_LIBRARY MSPACK_INCLUDE_DIR) 
-- libmspack not found
-- C CXX target wxbase cotired without unity build excluding 8 files.
-- CXX target wxnet cotired without unity build.
-- C CXX target wxcore cotired without unity build excluding 100 files.
-- CXX target wxadv cotired without unity build and precompiled header. Too few applicable sources.
-- CXX target wxaui cotired without unity build.
-- CXX target wxhtml cotired without unity build.
-- CXX target wxpropgrid cotired without unity build.
-- CXX target wxribbon cotired without unity build.
-- CXX target wxrichtext cotired without unity build.
-- C CXX target wxwebview cotired without unity build excluding /Volumes/Home/pvn/git/wx/wxwidgets-3.1.4/src/osx/webview_webkit.mm, /Volumes/Home/pvn/git/wx/wxwidgets-3.1.4/src/osx/webview_webkit.mm.
-- CXX target wxscintilla cotired without unity build.
-- C CXX target wxstc cotired without unity build excluding /Volumes/Home/pvn/git/wx/wxwidgets-3.1.4/src/stc/PlatWXcocoa.mm, /Volumes/Home/pvn/git/wx/wxwidgets-3.1.4/src/stc/PlatWXcocoa.mm.
-- CXX target wxxrc cotired without unity build.
-- C CXX target wxmedia cotired without unity build and precompiled header. Too few applicable sources.
-- C CXX target wxgl cotired without unity build excluding /Volumes/Home/pvn/git/wx/wxwidgets-3.1.4/src/osx/cocoa/glcanvas.mm, /Volumes/Home/pvn/git/wx/wxwidgets-3.1.4/src/osx/cocoa/glcanvas.mm.
-- CXX target wxqa cotired without unity build.
-- CXX target wxxml cotired without unity build.
-- Looking for 4 include files stdlib.h, ..., float.h
-- Looking for 4 include files stdlib.h, ..., float.h - found
-- Looking for va_copy
-- Looking for va_copy - found
-- Performing Test HAVE_VARIADIC_MACROS
-- Performing Test HAVE_VARIADIC_MACROS - Success
-- Performing Test HAVE_STD_STRING_COMPARE
-- Performing Test HAVE_STD_STRING_COMPARE - Success
-- Performing Test HAVE_STD_WSTRING
-- Performing Test HAVE_STD_WSTRING - Success
-- Performing Test HAVE_HASH_MAP
-- Performing Test HAVE_HASH_MAP - Failed
-- Performing Test HAVE_EXT_HASH_MAP
-- Performing Test HAVE_EXT_HASH_MAP - Success
-- Performing Test HAVE_STD_UNORDERED_MAP
-- Performing Test HAVE_STD_UNORDERED_MAP - Success
-- Performing Test HAVE_TR1_UNORDERED_MAP
-- Performing Test HAVE_TR1_UNORDERED_MAP - Failed
-- Performing Test HAVE_GCC_ATOMIC_BUILTINS
-- Performing Test HAVE_GCC_ATOMIC_BUILTINS - Success
-- Looking for sigaction
-- Looking for sigaction - found
-- Performing Test wxTYPE_SA_HANDLER_IS_INT
-- Performing Test wxTYPE_SA_HANDLER_IS_INT - Success
-- Performing Test wxHAVE_BACKTRACE
-- Performing Test wxHAVE_BACKTRACE - Success
-- Performing Test HAVE_CXA_DEMANGLE
-- Performing Test HAVE_CXA_DEMANGLE - Success
-- Looking for mkstemp
-- Looking for mkstemp - found
-- Looking for mktemp
-- Looking for mktemp - found
-- Performing Test HAVE_STATFS
-- Performing Test HAVE_STATFS - Success
-- Performing Test HAVE_STATFS_DECL
-- Performing Test HAVE_STATFS_DECL - Success
-- Looking for fcntl
-- Looking for fcntl - found
-- Looking for flock
-- Looking for flock - found
-- Looking for setenv
-- Looking for setenv - found
-- Looking for putenv
-- Looking for putenv - found
-- Looking for unsetenv
-- Looking for unsetenv - found
-- Looking for uname
-- Looking for uname - found
-- Looking for gethostname
-- Looking for gethostname - found
-- Looking for strtok_r
-- Looking for strtok_r - found
-- Looking for fdopen
-- Looking for fdopen - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for getpwuid_r
-- Looking for getpwuid_r - found
-- Looking for getgrgid_r
-- Looking for getgrgid_r - found
-- Looking for sys/soundcard.h
-- Looking for sys/soundcard.h - not found
-- Performing Test WX_SOCKLEN_T_IS_SOCKLEN_T
-- Performing Test WX_SOCKLEN_T_IS_SOCKLEN_T - Success
-- Performing Test SOCKOPTLEN_T_IS_SOCKLEN_T
-- Performing Test SOCKOPTLEN_T_IS_SOCKLEN_T - Success
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for gethostbyname_r
-- Looking for gethostbyname_r - not found
-- Looking for getservbyname
-- Looking for getservbyname - found
-- Looking for inet_aton
-- Looking for inet_aton - found
-- Looking for inet_addr
-- Looking for inet_addr - found
-- Performing Test wxHAVE_PTHREAD_CLEANUP
-- Performing Test wxHAVE_PTHREAD_CLEANUP - Success
-- Performing Test HAVE_PTHREAD_MUTEXATTR_T
-- Performing Test HAVE_PTHREAD_MUTEXATTR_T - Success
-- Performing Test HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL
-- Performing Test HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL - Success
-- Performing Test HAVE___THREAD_KEYWORD
-- Performing Test HAVE___THREAD_KEYWORD - Success
-- Performing Test HAVE_ABI_FORCEDUNWIND
-- Performing Test HAVE_ABI_FORCEDUNWIND - Failed
-- Looking for localtime_r
-- Looking for localtime_r - found
-- Looking for gmtime_r
-- Looking for gmtime_r - found
-- Performing Test wxSIZE_T_IS_NOT_UINT
-- Performing Test wxSIZE_T_IS_NOT_UINT - Success
-- Performing Test wxSIZE_T_IS_NOT_ULONG
-- Performing Test wxSIZE_T_IS_NOT_ULONG - Failed
-- Performing Test wxWCHAR_T_IS_REAL_TYPE
-- Performing Test wxWCHAR_T_IS_REAL_TYPE - Success
-- Performing Test HAVE_PW_GECOS
-- Performing Test HAVE_PW_GECOS - Success
-- Looking for ftime
-- Looking for ftime - not found
-- Looking for wcsftime
-- Looking for wcsftime - found
-- Looking for wprintf
-- Looking for wprintf - found
-- Looking for putws
-- Looking for putws - not found
-- Looking for fputws
-- Looking for fputws - found
-- Looking for vswprintf
-- Looking for vswprintf - found
-- Looking for vswscanf
-- Looking for vswscanf - found
-- Looking for wcsdup
-- Looking for wcsdup - found
-- Looking for wcsnlen
-- Looking for wcsnlen - found
-- Looking for wcscasecmp
-- Looking for wcscasecmp - found
-- Looking for wcsncasecmp
-- Looking for wcsncasecmp - found
-- Looking for wcsrctombs
-- Looking for wcsrctombs - not found
-- Looking for wcstoull
-- Looking for wcstoull - found
-- Looking for wcslen
-- Looking for wcslen - found
-- Looking for fsync
-- Looking for fsync - found
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for vsnprintf
-- Looking for vsnprintf - found
-- Looking for strnlen
-- Looking for strnlen - found
-- Looking for strtoull
-- Looking for strtoull - found
-- Looking for setpriority
-- Looking for setpriority - found
-- Looking for round
-- Looking for round - not found
-- Looking for C++ include tr1/type_traits
-- Looking for C++ include tr1/type_traits - not found
-- Looking for C++ include type_traits
-- Looking for C++ include type_traits - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for langinfo.h
-- Looking for langinfo.h - found
-- Looking for sched.h
-- Looking for sched.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for w32api.h
-- Looking for w32api.h - not found
-- Looking for wchar.h
-- Looking for wchar.h - found
-- Looking for wcstr.h
-- Looking for wcstr.h - not found
-- Performing Test wxTEST_TZ_timezone
-- Performing Test wxTEST_TZ_timezone - Success
-- Performing Test WX_GMTOFF_IN_TM
-- Performing Test WX_GMTOFF_IN_TM - Success
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for dladdr
-- Looking for dladdr - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for sys/select.h
-- Looking for sys/select.h - found
-- Looking for sys/inotify.h
-- Looking for sys/inotify.h - not found
-- Looking for sys/event.h
-- Looking for sys/event.h - found
-- Looking for xlocale.h
-- Looking for xlocale.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of locale_t
-- Check size of locale_t - done
-- Check size of pid_t
-- Check size of pid_t - done
-- Check size of size_t
-- Check size of size_t - done
-- Check size of wchar_t
-- Check size of wchar_t - done
-- Check size of int
-- Check size of int - done
-- Check size of long
-- Check size of long - done
-- Check size of short
-- Check size of short - done
-- Check size of gid_t
-- Check size of gid_t - done
-- Check size of uid_t
-- Check size of uid_t - done
-- Check size of mode_t
-- Check size of mode_t - done
-- Check size of off_t
-- Check size of off_t - done
-- Check size of long long
-- Check size of long long - done
-- Check size of ssize_t
-- Check size of ssize_t - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Searching 16 bit integer - Using unsigned short
-- Check if the system is big endian - little endian
-- Which libraries should wxWidgets use?
    wxUSE_STL:        OFF      (use C++ STL classes)
    wxUSE_REGEX:      builtin  (enable support for wxRegEx class)
    wxUSE_ZLIB:       sys      (use zlib for LZW compression)
    wxUSE_EXPAT:      sys      (use expat for XML parsing)
    wxUSE_LIBJPEG:    builtin  (use libjpeg (JPEG file format))
    wxUSE_LIBPNG:     builtin  (use libpng (PNG image format))
    wxUSE_LIBTIFF:    builtin  (use libtiff (TIFF file format))
    wxUSE_LIBLZMA:    OFF      (use liblzma for LZMA compression)
    wxUSE_LIBSDL:     OFF      (use SDL for audio on Unix)
    wxUSE_LIBMSPACK:  OFF      (use libmspack (CHM help files loading))

-- Configured wxWidgets 3.1.4 for Darwin-19.6.0
    Min OS Version required at runtime:                macOS 10.10
    Which GUI toolkit should wxWidgets use?            osx_cocoa 
    Should wxWidgets be compiled into single library?  OFF
    Should wxWidgets be linked as a shared library?    OFF
    Should wxWidgets support Unicode?                  ON
    What wxWidgets compatibility level should be used? 3.1
-- Configuring done
-- Generating done
-- Build files have been written to: /Volumes/Home/pvn/git/wx/wxwidgets-3.1.4/build_

pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: wxLogDebug flush

Post by pvn »

this call also has no effect

Code: Select all

wxLog* log = wxLog::GetActiveTarget();
log->Flush();
I don't know if this is a MacOS specific issue for this version or is this not the right way to flush the logs?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxLogDebug flush

Post by ONEEYEMAN »

Hi,
Can you step inside the Flush() call and see what it does?
What version of wxWidgets you are using?

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxLogDebug flush

Post by doublemax »

AFAIK wxLogDebug does not use a "normal" wxLog target (definitely not under Windows), so i don't think Flush() works for it.

Which log targets have you actually tried?
Use the source, Luke!
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: wxLogDebug flush

Post by pvn »

Which log targets have you actually tried?
I did not try anything, I don't know what to try;

I just want any call that gives an instant output to the IDE window log (QT Creator in this case)

I am using wxWidgets 3.1.4 in the Mac, not in Windows

in Windows (with Visual Studio) , I have used wxLogDebug before and it seemed to me that always gives an instant output;
but that is not relevant to this case
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxLogDebug flush

Post by ONEEYEMAN »

Hi,
Are you using Qt port of wxWidgets?
In any case - can you build a debug version of the library (if not already) and your application, and try to step inside the Flush().

Thank you.
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: wxLogDebug flush

Post by pvn »

Are you using Qt port of wxWidgets?

I am using wxWidgets 3.1.4 downloaded from the wxWidgets site
Built with QT Creator from the Cmake script

In any case - can you build a debug version of the library (if not already) and your application, and try to step inside the Flush().
ok, what should I look for ?
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: wxLogDebug flush

Post by pvn »

Which log targets have you actually tried?
What would be the steps to try other wxLog targets?
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxLogDebug flush

Post by doublemax »

pvn wrote: Wed Nov 18, 2020 5:33 pm
Which log targets have you actually tried?
What would be the steps to try other wxLog targets?
The easiest would be wxLogWindow. https://docs.wxwidgets.org/trunk/classw ... indow.html
Use the source, Luke!
Post Reply