Post not yet marked as solved
It seems like signposts generated with os_signpost() APIs are not appearing in the trace files collected with ktrace (ktrace artrace).
On the other hand, if the signposts are generated with kdebug_signpost APIs - they do show up correctly.
Is this expected behavior?
Specially since the kdebug_signpost APIs are now deprecated?
Thanks.
Devendra.
ps: The os_signpost generated signposts do appear if capturing with Instruments app, just that they are not captured by ktrace.
Post not yet marked as solved
Hi
I have watched this video https://developer.apple.com/wwdc20/10168
and tried to implement Logger in my application.
Then I've tried to generate .logarchive file from my iPhone device using this command (as it was mentioned in the video):
sudo log collect --device --start '2021-09-07 10:00:00' --output logTest.logarchive
where the result was:
Archive successfully written to logTest.logarchive
However, when I double-click over this file it opens the Console.app but then it stays infinitely loading the .logarchive.
Some notes:
The file size is about 150Mb, so I believe is not related with this.
Am I doing something wrong? Can you please help me?
Thanks in advance
Hi, all. I try logging some message of my console application.
Just like syslog daemon in linux, I want to change and apply facility and level printing if requested.
So, I just try to use syslog API and os_log API both of them.
And try to change syslog.conf, add asl.configuration in /etc/asl directory But, it seems not to be applied.
Only I can see, log messages can be gotten by using "log" command not saved to file.
How can i config just like syslog system in linux and apply this?
Thansk.
Post not yet marked as solved
How to Fix 'doesn't have get-task-allow' in LogEntry which was retrieved using OsLogStore.
Example log output :
2021-08-18 11:47:05 +0000 macOSTaskPolicy: (kav) may not get the taskport of (opendirectoryd) (pid: 131): (opendirectoryd) is hardened, (opendirectoryd) doesn't have get-task-allow, (kav) is not a declared debugger\
The above log is not having a proper log Message . Kindly help me to resolve this isse
Post not yet marked as solved
I'm looking to construct a custom logger API. For example:
log.verbose(Date(), "Begun process")
(That's contrived example, the point being some object and a message. I will then be manipulating both.)
Within my Log object I then want to transform the date value and the message into a final log message. "Nanoseconds: 9790324:: Begun process". If I was working with strings, it would be a pretty simple issue. But I'm not. It looks like Logger, which actually does the logging takes in a OSLogMessage which I cannot instantiate and cannot pass by value or reference. Even if I had just:
func verbose(_ date: Date, _ message: OSLogInterpolation) {
log(date: Date, level: .info, message: message)
}
func info(_ date: Date, _ message: OSLogInterpolation) {
log(date: Date, level: .default, message: message)
}
private func log(date: Date, level: OSLogType, message: OSLogInterpolation) {
// Neither of these work
log.log(level: level, message)
log.log(level: level, OSLogMessage(interpolation: message))
}
Ideally what I'd like is:
private func log(date: Date, level: OSLogType, message: OSLogInterpolation) {
let interpolation = "Nanoseconds: \(date.getNanoseconds):: " + message
log.log(level: level, OSLogMessage(interpolation: interpolation))
}
With the idea being that OSLogMessage is still respecting any privacy notices on the interpolation.
Post not yet marked as solved
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 not yet marked as solved
I have a Swift 3 Cocoa application that uses Apple's Unified Logging, like this: - import os
class MyClass
{
@available(OSX 10.12, *)
static let scribe = OSLog(subsystem: "com.mycompany.myapp", category: "myapp")
func SomeFunction(){
if #available(OSX 10.12, *){
os_log("Test Error Message", log: MyClass.scribe, type: .error)
}
if #available(OSX 10.12, *){
os_log("Test Info Message", log: MyClass.scribe, type: .info)
}
if #available(OSX 10.12, *){
os_log("Test Debug Message", log: MyClass.scribe, type: .debug)
}
}
}Within the Console application, both Include Info Messages and Include Debug Messages are turned on.When os_log is called, only the error type message is visible in the Console application.Using Terminal, with the command, all message types are visible in the Terminal output: -sudo log stream --level debugI've tried running the Console app as root, via sudo from the command line and the same issue occurs; no debug or info messages can be seen, even though they're set to being turned on under the Action menu.Setting system-wide logging to be debug, has no effect on the Console application output:sudo log config --mode level:debugPlease can someone tell me what I'm missing and how can I view debug and info messages in the Console application?