Using the Console statement

If I send a message to the console, where do I find that message in the console app? There are so many messages there that I can’t see the tree for the forrest.

Choose your computer under “Devices”. You can then use the search box to search for it. If you give all your messages a common header, you could search for that, and have them displayed all together.

and where exactly would I find “Devices” ?

At the top of the column on the left side of the window.

Thanks Dave!

I just learned something an hour ago relevant to this, I was going to make a new post but this topic came up with perfect timing!

Using a text editor, create a file named something like this (the name can be whatever you like, but must end with .command).

Panorama Test.command

and fill it with this (I’m assuming your copy of Panorama X is in the /Applications folder, if not, this must be adjusted):

#!/bin/bash
/Applications/PanoramaX.app/Contents/MacOS/PanoramaX

Save this somewhere on your disk (but not on the Desktop, I discovered that doesn’t work).

When you double click on this file, Terminal.app will be launched, and then PanoramaX will be launched from within Terminal.app. Any console output will immediately show up in the terminal window. You won’t have to dig it out from a ton of other stuff.

You can even put your Panorama Test.command file in the dock, and launch it from there.

What’s new to me today is finding out about .command files. But I’ve been using Xcode and Terminal.app to view PanoramaX log output for years – when used with the nslog statement it’s a fantastic debugging tool.

I played a little with your .command file discovery. It needs to be done when PanoramaX isn’t already open, else it will open another copy of a PanoramaX process. nslog messages from the former copy won’t appear (latter’s will) in that terminal window although they will appear in the Console. Quiting Terminal will also quit its running PanoramaX process. I’d thought I could get your trick started in an already open database programmatically via openanything *.command but it doesn’t appear that will work, at least not via this bash script.

Sorry, I was aware of all of your points, but in my excitement forgot that most of you probably don’t use Terminal.app regularly. By the way, what was new to me was the fact that you could launch “pre-canned” terminal sessions by packaging them in a .command file. I’ve known for years that you could launch Panorama inside Terminal.app and watch the console output, I think I’ve mentioned it here a couple of times. But it was always in the context of having to manually type in a long, hard to remember command. With this .command file trick, it’s super easy and fast.

So, as John points out, you have to decide to do this before you launch Panorama. There is no way to take an existing Panorama session and suddenly send the console output to Terminal.app. The good news is that there is really no reason to not always run Panorama under Terminal.app. It doesn’t run any slower. That way, if you need to look at some console output you are ready to go. I’m sure this isn’t for everyone (and it does add a bit of screen clutter), but if you are doing a lot of Panorama coding/debugging, this is a great tool. When I’m running Panorama myself I almost always do so in the Xcode debugger, which is essentially the same idea as running under Terminal.app (of course with additional tools that allow me to work with Objective-C code).

As John also points out, if you quit Terminal.app while Panorama is running under it, that will also force quit Panorama. In fact, simply closing the Terminal.app window will also force quit Panorama. So you probably don’t want to close that window before you quit Panorama yourself. But again, other than a bit of screen clutter there is really no reason you can’t keep Terminal.app open all the time and always run Panorama using it, at least when you are doing significant coding/debugging.

That would be cool but I’m pretty sure there is no way to launch this from Panorama itself (well, other than launching a second session of Panorama). It has to be launched from the Finder. You can put the .command file in the dock so it just takes a single click to get your coding/debugging session started.

On the other hand, the way Panorama X server works this is not only possible, but has been baked into Panorama X Server almost from the start. It’s been an invaluable tool in debugging this upcoming product. Here’s part of the server preferences panel that shows that running Panorama X Server under Terminal.app is as simple as clicking a checkbox.

Here is what I worked out to use the Console app with Panorama X. First we must prepare the Console to filter for only Panorama X entries. Use the console statement in Panorama X to make an entry into the Console that is easy to find in the Console app. Once found, right click on that entry and select “Show Library ‘PanoramaX’”. This will select entries with this criteria and a Box for ‘Library’ and one for ‘PanoramaX’ will now appear in the search box. There will also be a Save button appearing underneath it. Click that button and name your search “PanoramaX” and it will now show as a setting along with ‘All Messages’ and ‘Errors and Faults’ in the tool bar. Notice in the Console Action menu that PanoramaX is now listed at the bottom with an activation key code of command-3. We will need to know the exact key combination for a little later.

Now that we have the ground work established let’s see if we can automate using this setup with a Panorama procedure via AppleScript. Close the console so we can start fresh. This Panorama code assumes the PanoramaX key code in the Console menu is command-3 (you will have to adjust the key code in the AppleScript if it is something else). Run this code:

applescript 
{tell application "Finder"
	activate
	open application file "Console.app" of folder "Utilities" of folder "Applications" of startup disk
end tell
tell application "System Events"
	key code 20 using command down
end tell}

The Console app will open and the PanoramaX message filter will be active waiting for your Panorama X console commands to be displayed. Note that I am doing this on my old iMac stuck with macOS 10.13.6 High Sierra. Here is a screen shot of my Console setup:

One final note: If you want to show all PanoramaX console entries choose “Show Process ‘PanoramaX’” when you right click the original entry to start with instead of the Library entry.

1 Like

Gary,
That is merely awesome! Thanks for doing this.
Cheers from Canadadadada