Where Are Logs Output When Running a Script From Script Menu?

Where do log-statements end up when you run a compiled script from Script Menu?

log-statemens can not output log to Script Editor’s log area if runtime program is not Script Editor.

So, there are some other ways to write log (Console.app).

You can use logger command

(2)Cocoa way
You can use NSLog command

1 Like

Aren’t they somewhere in the Console app?

I looked there but couldn’t find anything. Intuitively, one would think that they should appear there.

No. During runtime, outside script editor or script debugger (or similar) the log command has no effect.

You can do an

On Log(logValue)
--do something


If the user places both the standard log command and the custom log() handler () in the script, they will conflict (the standard log is blocked). So it’s better to always put the “reserved” name of handler in pipes.

At least the standard log command is handy while the script is being debugged in the Script Editor.

on |log|(logValue)
	--do something
end |log|

log "Not blocked now"

But, that method doesn’t allow you to do anything with the log value:

on log (logValue)
	--do something
	display dialog logValue
end log

log "Not blocked now"

Since I use ScriptDebugger the log command is not that useful compared to the variable watchers, so I don’t mind not having it. Of course, your mileage may vary.

Well, I don’t mind your handler. And the standard Log command is really useless in Script Debugger. It’s just that in the way you suggest it, a novice user can create an unforeseen situation, as indicated above. And it is such a very unpleasant and hidden mistake. Look here:

on log (theValue)
end log

log "a" -- not logged in Script Editor & Script Debugger

Yes. If I wanted the log command in SD or SE I would commented out the onLog handler.

Example is here.


1 Like