Logic Pro and stderr or DBG()

I’m trying to do some debugging of a plugin using Logic Pro by inserting some debug output statements. However stderr and DBG() don’t display anything in the XCode output panel. It works ok with other DAWs, but not Logic. Anybody have any tips for getting output onto the XCode output panel when using Logic?

Since switching to M1 (which has out of process plugin hosting) I’m not able to get logs in Logic.

My workarounds ATM are:

  1. Use Logic in Rosetta mode
  2. Use other DAWs that can load AU plugins (Reaper, etc)
  3. Use a file logger instead of DBG/std::cout/etc.

Thanks. If I turn on the “Run under Rosetta” Finder option on Logic, XCode still seems to launch the ARM version. Am I overlooking a way to force XCode to run the x64 version with Rosetta?

You can attach manually with debug->attach to process right after launching Logic.
(Which you also need to do on the ARM-native version too to hit breakpoints and such because the actual process isn’t the Logic process, it’s the AU hosting process)

I was just wondering if there’s a way to instruct XCode to launch Logic to run under Rosetta. That would be simpler than attaching.

I’m not having any luck attaching to the AUHostingService process anyway. I get an error reported in the console:

Xcode[445]: DEPRECATED USE in libdispatch client: Changing the target of a queue already targeted by other dispatch objects;

At the top of your Xcode window, you can choose that:

image

Excellent, thank you!

I’m having the same issue trying to debug REAPER in XCode - still not seeing anything written to stdout, stderr, or anything else. Is there any way to get this natively on Mac w/o Rosetta?

Actually, quick edit, just opening /Applications/REAPER.app/Contents/MacOS/REAPER manually in a terminal works, where one can see stdout. I don’t see the same output with Logic Pro, though.

For some reason, neither of these DAWs have stdout appear in XCode’s console output when attached as a debugger, even with REAPER and regardless of if the plugin is VST or AU. But, if you at least just want to see what’s happening, you can run REAPER from the terminal to get stdout there, and then attach XCode’s debugger to it as well.

So it seems like two separate problems:

  1. Logic Pro doesn’t output stdout at all
  2. XCode doesn’t seem to put stdout in its console

Not sure what the solution is for either of these. I’m on macOS M1 FWIW.

You can always use FileLogger

Rail

Sure, as long as it isn’t the audio thread…

On my system, I find that running Logic Pro X under rosetta in the terminal gives me the DBG output I want:

arch -x86_64 "/Applications/Logic Pro X.app/Contents/MacOS/Logic Pro X"

MacOS Ventura 13.6
Logic Pro X 10.7.9

I wrote my own realtime safe implementation of a logger. It is actually very straight forward using AbstractFifo from JUCE. You have the audio thread pushing messages and any other thread pulling. There is however one big caveat: if you are gunning for a „release“ stable implementation, you have to make due without string concatenation.
I implemented this by reserving 265 bytes per message as variable storage and the pulling thread later does the string replacement similar for printf.

It’s probably a days work but it was worth it in my book. :slight_smile: