So far we have created our own log target using wxLogStream.
In the current wxWidgets version (3.1.4) this no longer works for macOS and Linux. On Windows everything runs smoothly.
Code: Select all
wxString path = wxS("/Users/<username>/Library/Preferences/<softwarename>/") + wxS( "log.txt" );
std::string logpath = ( const char* )path.char_str();
wxLog* logger=new wxLogStream( new std::ofstream( logpath.data() ) );
wxLog::SetActiveTarget( logger );
wxLogMessage(wxS("Hello World"))
There is a workaround using wxLogStderr and works on all three platforms.
Code: Select all
wxString path = wxS("/Users/<username>/Library/Preferences/<softwarename>/") + wxS( "log.txt" );
std::string logpath = ( const char* )path.char_str();
FILE* fp = fopen(logpath.data(), "w");
wxLog *logger = new wxLogStderr(fp);
wxLog::SetActiveTarget( logger );
wxLogMessage(wxS("Hello World"));