Post marked as unsolved
32
Views
On 11.3 and 11.4 I see some of the log entries are missing when using os_log(Default, "....");
Wondering if there is a configuration param I should use.
Also does it matter, if I have my own serial and concurrent queues ( 'm not worried about the sequence of the print, just that will it print into log , so some form of $ low collect I can use)
Thanks,
Prokash
Post marked as solved
31
Views
Am I right that .auto is just the default privacy specifier for when an explicit one is not mentioned in the log code, and as such there is no need to ever use it explicitly?
swift
var i =123
var s = "hello"
myLogger.log("\(s, privacy: .auto), \(i, privacy: .auto)")
produces the same log as:
swift
myLogger.log("\(s), \(i)")
and that s == "private" in the logs and i == 123
Also in:
swift
myLogger.log("\(s, privacy: .auto(mask: .hash)), \(i, privacy: .auto(mask: .hash))")
that only s will be hashed as i resolves to being public so no masking is needed and 123 is displayed.
(The documentation could really use some actual examples of more use cases)
Post marked as unsolved
55
Views
I've been using the os.Logger API, but it looks like I need to create an OSLog as well if I want to use the signpost API for tracking performance.
Is that true, or is there some way get an underlying OSLog from a Logger? Then I could write something like:
swift
extension os.Logger {
func signpost(...) {
os_signpost(.begin, ... self.osLog, ...)
}
}
Post marked as unsolved
158
Views
Hi, I am trying to collect OSLog's logs using the OSLog framework, but I am not being able to access them. I've seen some examples that use something like this:
swift
import OSLog
let myLogStore =try OSLogStore(scope: .currentProcessIdentifier)
but when I try to run it throws:
bash
main.swift:5:20: error: argument labels '(scope:)' do not match any available overloads
main.swift:5:20: note: overloads for 'OSLogStore' exist with these partially matching parameter lists: (URL: URL), (url: URL)
I couldn't find any solution on google so far...
I am running it on a Mac OS X's 10.15 with Darwin Kernel Version 19 and Swift version 5.2.2
Any guidance on how to collect logs by using this framework will be highly appreciated
Post marked as Apple Recommended
853
Views
We tried to adopt OSLog in past years, but it was really cumbersome to retrieve the logs from customers.
Doing a sysdiagnose is a really cumbersome task for most non-technical users to perform. Additionally they contain WAY more information than we need and are generally very large.
This is true for macOS and iOS apps.
Are there any new facilities for retrieving just the logs for a given subsystem that we could trigger with code, for instance in a help menu?
Post marked as unsolved
256
Views
In our app, we need to provide a feature for user to send application logs to us in case they run into unexpected errors. If we use OSLog feature to log our app's error/warning state, is there a way to programmatically to collect our app log from within our app so that we can provide a feature for user to send us the archived log files within our app?
Post marked as solved
95
Views
What's the proper way to enable showing "private" items from os_log?
I see various mobileconfig files on different web sites - signed by people I may not trust!
I would like to know where this is documented and if Apple provides such configuration profiles?
Thanks.
Devendra.
Post marked as unsolved
79
Views
I'm trying to diagnose a problem with a keyboard extension. It shows up only on a customer device. I added some verbose logging to the extension, deployed via TestFlight, and had them send me the system_logs.logarchive from a sysdiagnose.
It shows them installing the update from TestFlight and then the keyboard launches as PID 612 and logs successfully. Then the app is terminated for a strange reason ("Terminating plugin com.natdes.Typefinity.Typefinity-Keyboard of com.natdes.Typefinity because access to the kTCCServiceKeyboardNetwork service changed."). It relaunches 3 seconds later as PID 613. However PID 613 never shows up as logging anything itself. Even though it proceeds to run and serve keyboard requests for the next 24 hours until the log ends. (I can see all the messages of processes communicating with it.)
Does anyone know of a reason why a process might be wholesale-excluded from the system_logs in a sysdiagnose? Is it just falling on the wrong side of some arcane retention policy? Is there any way from the app side to prevent this?
Thanks.
Post marked as unsolved
80
Views
I am trying to view unredacted system logs on my iPhone[1]. The following mobileconfig works on my Mac, but gives me a "This profile is corrupted and cannot be read" error when attempting to install on my phone.
plist
?xml version="1.0" encoding="UTF-8"?
!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"
plist version="1.0"
dict
keyPayloadContent/key
array
dict
keyPayloadDisplayName/key
stringManagedClient logging/string
keyPayloadEnabled/key
true/
keyPayloadIdentifier/key
stringcom.apple.logging.ManagedClient.1/string
keyPayloadType/key
stringcom.apple.system.logging/string
keyPayloadUUID/key
stringE88C2196-5E0F-488F-86D6-13C26D2C9B97/string
keyPayloadVersion/key
integer1/integer
keySystem/key
dict
keyEnable-Private-Data/key
true/
/dict
/dict
/array
keyPayloadDescription/key
stringEnable Unified Log Private Data logging/string
keyPayloadDisplayName/key
stringEnable Unified Log Private Data/string
keyPayloadIdentifier/key
string0F6864BF-2957-4334-AA42-A4E75210C316/string
keyPayloadRemovalDisallowed/key
false/
keyPayloadScope/key
stringSystem/string
keyPayloadType/key
stringConfiguration/string
keyPayloadUUID/key
stringFD4DE75C-4B21-4C76-86F6-C74895108CDF/string
keyPayloadVersion/key
integer1/integer
/dict
/plist
Are there any alternate methods for unmasking the log data on my iPhone?
[1]iPhone 11, iOS 14.5 beta, build 18E5164h.
Post marked as unsolved
117
Views
Hi,
I've added a functionality in my app which lets the user share logs of the app to me in case they face any issues. I'm using Cocoalumberjack logging framework for this.
The problem I'm facing is that I'm not able to capture logs of app crash. When the app crashes due to some reason, I ask the user to send logs to me via a send logs button given in the app but in the logs file i receive from the user, the crash log is not there.
Kindly let me know if there's any way I can log the app crash.
Post marked as unsolved
158
Views
My iOS app has a function that logs a whole load of statistics about a particular object. Since this is only for dev purposes I don't want any of the actual statistics gathering to be run if debug logs are not enabled so I am checking OSLog.default.isEnabled(type: .debug) before doing anything. Here is the basic shell of my code:
swift
func dumpStatistics(for item: Any) {
func callSomeVerySlowFunc(_ object: Any) - String {
/* Something much more complicated than this */
return "Hello"
}
guard OSLog.default.isEnabled(type: .debug) else {
NSLog("Not dumping Statistics, debug logging is disabled")
return
}
NSLog("(NSLog) dumping Statistics, debug logging is supposedly enabled")
os_log(.debug, "(os_log)dumping Statistics, debug logging is supposedly enabled")
let stats: String = callSomeVerySlowFunc(item)
NSLog("(NSLog) dumping Statistics: %@", stats)
os_log(.debug, "(os_log) dumping Statistics: %{public}@", stats)
}
When "Show Debug Info" is enabled in Console, this is what I get (as expected):
(NSLog) dumping Statistics, debug logging is supposedly enabled
(os_log)dumping Statistics, debug logging is supposedly enabled
(NSLog) dumping Statistics: Hello
(os_log) dumping Statistics: Hello
When "Show Debug Info" is disabled, this is what I expect to get:
Not dumping Statistics, debug logging is disabled
However, this is what I actually do get:
(NSLog) dumping Statistics, debug logging is supposedly enabled
(NSLog) dumping Statistics: Hello
This implies that OSLog.default.isEnabled(type: .debug) is always returning true, but the actual logging code itself knows it's not really enabled.
So this has the effect that I go through all the expense of calculating the statistics when I shouldn't.
(BTW - I added the NSLog calls to help me see what was really happening. I don't intend to keep them in there)
I don't think I am doing anything wrong in my code.
I'm running macOS 10.15.7 alongside two iPads, one with iOS 14.3 and one with 14.4. Both iPads are connected via USB
Post marked as unsolved
503
Views
I'm using a Macbook Pro mid 2014 (Big Sur) and try to investigate wifi connection problems.
My router (Fritz!Box 7590) shows in the logs that constantly every 10 minutes the Macbook has been logged of from the wifi network (802.11ac) and logged on again.
E.g. it shows that at 10:04:30 the device has been logged off and then at 10:04:34 logged on again.
I turned on wifi logging on my Macbook:
wifi.log - https://developer.apple.com/forums/content/attachment/af953247-3676-411e-a4d8-24400ef31f5d
Unfortunately I don't understand the contents of the wifi.log.
May anybody give me a hint if there are specific log messages that indicate the reason for logging off and logging on again?
Best regards
Post marked as unsolved
144
Views
Hi, all, I just want to use os\_signpost to capture start and end time of some interested events when learning webkit source codes. I follow the steps of how to use os\_signpost in Instruments, but fail to see any self-added trace, all are system level.
While if I new a command line tool project and do same things, then I could see those self-added trace. So is os\_signpost unsupported for webkit? Or what other steps do I need to do to get os\_signpost enabled in Instruments?
Thanks
Post marked as unsolved
116
Views
I want to print all the xcode console log onto a UITextview inside an iPhone app page.
I have checked few solutions like: redirect NSlog to file like below,
NSString *logPath = [self getFilePath];
freopen([logPath fileSystemRepresentation],"a+",stderr);
But this doesn't work for os_log as it's not showing the log when phone is detached from xcode.
Is there any way I can do this?
Post marked as unsolved
120
Views
Hi,
For one of our project, we are looking to help our customers to derive actions based on the calls they made. Is there a way to access the calls log data?
TIA