OSLog is a unified logging system for the reading of historical data.

Posts under OSLog tag

166 Posts

Post

Replies

Boosts

Views

Activity

'doesn't have get-task-allow' in LogEntry
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
9
0
2.2k
Sep ’21
os_signpost not appearing in ktrace
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.
2
0
1.4k
Sep ’21
How can I use syslog API on BigSur and after?
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.
3
0
1.3k
Sep ’21
How can I construct custom loggers?
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.
2
0
1.2k
Aug ’21
How to collect logs from OSLog with swift?
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
8
1
9.9k
Aug ’21
'doesn't have get-task-allow' in LogEntry
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
Replies
9
Boosts
0
Views
2.2k
Activity
Sep ’21
URL access log via Open Proxy
Is it possible to get the URL access log when a client access websites via Open Proxy (I mean the proxy outside of the organization) as a system log? Of course I think browser history records the access URL but it is not a log. Than you in advance.
Replies
1
Boosts
0
Views
589
Activity
Sep ’21
os_signpost not appearing in ktrace
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.
Replies
2
Boosts
0
Views
1.4k
Activity
Sep ’21
How can I use syslog API on BigSur and after?
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.
Replies
3
Boosts
0
Views
1.3k
Activity
Sep ’21
How can I construct custom loggers?
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.
Replies
2
Boosts
0
Views
1.2k
Activity
Aug ’21
How to collect logs from OSLog with swift?
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
Replies
8
Boosts
1
Views
9.9k
Activity
Aug ’21