Logging Max Window (console) to file

asur222's icon

How do you log the console/Max window to a file?

I'm writing an external and it crashes Max whenever I run it. I want to use print statements to debug when the external is causing it to crash.

Or is there a smarter way to debug it?

Emmanuel Jourdan's icon

You can debug your object with the Runtime and your favorite IDE. You might also use cpost() method which works like post() except that it send the string to the Console instead of the Max window.

asur222's icon

cpost() doesn't work, it's not recognized as a function; is there a library I need to include?

I'm using Xcode on Mac. I tried copying the Max MSP runtime into my build/Development/ directory, and selecting that as the runtime for my executable. However, as I debug it, I get this error:

JUCE v1.45. no interfaces folder, you are in serious trouble!

Bernt Isak's icon

Is there a way to log the console/Max window to a file? I'm not debugging an external, but I'm building a Max For Live-device which uses the csound~-object. It would be really helpful to get a log-file from the Max window for debugging purposes. I've tried to use the -OFILE/--logfile=FILE-console statements in the csound-message, but it doesn't seems like Csound is picking it up.

Timothy Place's icon

There is a message to Max "setmirrortoconsole" which will mirror Max window output to the console. You could then launch Max from the command line and redirect the output to a file if you like.

Bernt Isak's icon

I actually tried that message a couple of days ago, but couldn't get it to work it seemed. Worked when I tried it now though. It solves the problem with debugging, but I have to use the console-app since it's a Max For Live-device and therefor cannot run Max from the command line. Would have been nice to have a log-file, but I guess using the console-app works just fine :)

Thanks anyways Timothy!

AudioMatt's icon

It's actually not working for me now either... used to. V8.0.0

yurki's icon

@BERNT ISAK

For those who just look for writing the max console to a file in max itself, I got this working:

Max Patch
Copy patch and select New From Clipboard in Max.

hardcoder's icon

There is even an easier way. Just insert the console object and feed it with a "write" message. A savefile dialog opens and saves the entire console.

MMa's icon

@Yurki great!