How to retrieve syslog from sandbox?

Is there a permissible way to retrieve the syslog from a sandboxed app?

I’m retrieving the syslog for my app like this:

[code] Dim retStr As String = “”
#If TargetCocoa

Dim s As New Shell
Dim cmd As String = "syslog -k Sender '" + App.kAppName + "'"
// Now list Seminar Pro syslog

If s.ErrorCode <> 0 Then
  im.logError("[" + CurrentMethodName + "] SHELL ERROR  : " + Str(s.ErrorCode))
  im.logError("[" + CurrentMethodName + "] SHELL RESULT : " +   s.Result)
End If

retStr = s.Result


Return retStr

This works when not sandboxed. Of course, from the sandboxed app, it raises an exception:

[code]syslog(366) deny file-read-data /private/var/log/asl

Process: syslog [366]
Path: /usr/bin/syslog
Load Address: 0x105435000
Identifier: syslog
Version: ??? (???)
Code Type: x86_64 (Native)
Parent Process: Seminar Pro [358]

Date/Time: 2014-01-01 07:33:30.280 +0100
OS Version: Mac OS X 10.9.1 (13B42)
Report Version: 8

Thread 0:
0 libsystem_kernel.dylib 0x00007fff897a8622 __open_nocancel + 10
1 libsystem_asl.dylib 0x00007fff88cf647e asl_store_match_timeout + 75
2 libsystem_asl.dylib 0x00007fff88cf65a0 asl_store_match + 27[/code]

using an official API if one exists of course.

Yes - I saw you have NSLogMBS in order to write to the log, but I did not find anything to search and retrieve log entries - apart from the above shell command.

I’m not a XCode developer, so I easily may miss something. Do you know any such API?

The sandbox restricts access to the system log and there is no public entitlement that changes this.

Oh crap - I built the whole reporting of activities around logging, and this can be enabled by the user. It helps in particular during beta testing. But now that I switch to sandbox, I have to build my own logging system. Sometimes I just would like to have one of those responsible Apple chief executive blablablas in front of me and use them as a punching ball for my daily karate practice… aechz.

Maybe this API?

Not sure if it’s sandbox allowed.

Yes asl seems to be the way to go. There is a ASLogger project on Github, but unfortunately I do not have the skills to make use of this. Maybe something for the MBS Plugins?

Before we put a lot of work on this, maybe check if it’s working with sandbox…

I couldn’t read the log from a Samdboxed App Wrapper either.

What are you trying to extract from the system log?

On one hand I have a verbose mode where the user can switch on logging of SQL statements. This can be useful to track down unexpected results.
On the other hand I would like to get any log entry related to that specific application, including any crash reports (if there are any).
Unfortunately it looks like I cannot use syslog from a sandbox (like : syslog -k Sender ‘Seminar Pro’ )

If you’re able to do so, log the SQL statements to a file you can access.

As for syslog, you should be able to add an entitlement to specifically access the command. However I can’t guarantee that Apple will approve the use of the command.