+#if wxUSE_LOG
+    // Reset logging in case we were cleaned up and are being reinitialized.
+    wxLog::DoCreateOnDemand();
+
+    // install temporary log sink: we can't use wxLogGui before wxApp is
+    // constructed and if we use wxLogStderr, all messages during
+    // initialization simply disappear under Windows
+    //
+    // note that we will delete this log target below
+    delete wxLog::SetActiveTarget(new wxLogBuffer);
+#endif // wxUSE_LOG