Get verbose c standard output logging to a powershell console

danrossi

New Member
I am unable to get standard output logging when launching obs with powershell. I need to get access to verbose logging of an integrated rust library in a plugin.

In mac and Linux when launching obs from the console logging is shown. With windows there is no logging at all and exits the process after launching.

The command I am doing is something like

$env:RUST_LOG="debug"; $env:RUST_BACKTRACE=1; $env:OBS_LOG_LEVEL="debug"; Set-Location "build_x64\rundir\RelWithDebInfo\bin\64bit"; & .\obs64.exe --verbose

I get nothing. I tried alot of tricks and nothing.
 
Yeah, OBS on Windows behaves differently here. obs64.exe is built as a GUI subsystem app, so stdout/stderr usually are not attached to the PowerShell console at all. That’s why you see logs on Linux/macOS but nothing in Windows terminal.

OBS still writes logs though. Check:

%appdata%\obs-studio\logs

For Rust specifically, if your library uses env_logger or tracing_subscriber with console output only, you probably won’t see anything unless you manually attach a console or redirect logs into OBS logging APIs / a file.

One thing that helped me was launching OBS from cmd.exe instead of PowerShell. Sometimes PS swallows stuff weirdly with GUI apps. Also try:

.\obs64.exe --verbose --unfiltered_log

But honestly, for plugin debugging on Windows I ended up writing Rust logs directly into a file because console logging was unreliable with OBS.
 
It's using tracing_subscriber internally. It only outputs to the console. Nothing gets captured in the OBS logger. Only logs in the plugin does. Is there a way to capture output from tracing_subscriber to a file ?
 
I don't normally work in c++ but am slowly navigating it. It took ages to figure this out. I have a console in Windows enabled showing the internal rust stderr output with this in the plugin

at the top
#ifdef _WIN64
#include <windows.h>
#include <cstring>
#endif



inside obs_module_load

#ifdef _WIN64
const char* logLevel = std::getenv("RUST_LOG");
if (logLevel && strcmp(logLevel, "debug") == 0)
AllocConsole();
#endif
 
Back
Top