• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Where Do Apple Event Log Entries Go if not Running in a Script Editor?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where Do Apple Event Log Entries Go if not Running in a Script Editor?


  • Subject: Re: Where Do Apple Event Log Entries Go if not Running in a Script Editor?
  • From: Shane Stanley <email@hidden>
  • Date: Fri, 01 Jan 2016 11:58:01 +1100

On 1 Jan 2016, at 11:31 AM, Stockly, Ed <email@hidden> wrote:

Turns out you can trap a log command, but can’t really do anything with it. It just prevents the script editor from logging.

log "hello world"
on log
beep
— my routine for creating and updating a log file would go here with the value that would be logged
continue log— sends the logged value to the AE log in the script editor

end log

You just need  to include the argument:

log "hello world"
on log x
beep
-- my routine for creating and updating a log file would go here with the value that would be logged
continue log x -- sends the logged value to the AE log in the script editor
end log

FWIW, the log command isn't defined to do anything -- it's actually up to the running application to implement it. Script editors do, and I think these days osascript routes it to stdOut. Xcode-based ASObjC apps also send it to stdOut.

FYI, if you want to log to Console.app, you can use shell scripting or NSLog:

use framework "Foundation"

set x to "hello world"
current application's |NSLog|("I'm logging %@", x) -- In Console.app: 1/01/2016 11:55:05.234 AM Script Editor[40681]: I'm logging hello world

But there are gotchas in what you can log that way.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Where Do Apple Event Log Entries Go if not Running in a Script Editor? (From: "S. J. Cunningham" <email@hidden>)
 >Re: Where Do Apple Event Log Entries Go if not Running in a Script Editor? (From: Shane Stanley <email@hidden>)
 >Re: Where Do Apple Event Log Entries Go if not Running in a Script Editor? (From: "Stockly, Ed" <email@hidden>)

  • Prev by Date: Re: Mail attachments
  • Next by Date: Re: Mail attachments
  • Previous by thread: Re: Where Do Apple Event Log Entries Go if not Running in a Script Editor?
  • Index(es):
    • Date
    • Thread