These pieces of code:
https://github.com/bitcoin/bitcoin/blob/8ab4f282c06d67074b872dbda0be37636fdd5186/src/util/system.cpp#L302
and
https://github.com/bitcoin/bitcoin/blob/8ab4f282c06d67074b872dbda0be37636fdd5186/src/util/system.cpp#L864
do not work as expected because they are called before the `InitLogging()` call.

m_msgs_before_open.push_back(str_prefixed);
        return;
    }
    if (m_print_to_console) {
        
        fwrite(str_prefixed.data(), 1, str_prefixed.size(), stdout);
        fflush(stdout);
    }
    if (m_print_to_file) {
        assert(m_fileout != nullptr);
        
        if (m_reopen_file) {
            m_reopen_file = false;
            FILE* new_fileout = fsbridge::fopen(m_file_path, "a");
            if (new_fileout) {
                setbuf(new_fileout, nullptr); 
                fclose(m_fileout);
                m_fileout = new_fileout;
            }
        }
        FileWriteStr(str_prefixed, m_fileout);
    }
}
void BCLog::Logger::ShrinkDebugFile()
{
    
    constexpr size_t RECENT_DEBUG_HISTORY_SIZE = 10 * 1000000;
    assert(!m_file_path.empty());