0

I'm working on a logger that is based on Unified Logging System that supports activities/scopes and I've found that a message with fault level type is not captured by any of my activities:

var os_state = os_activity_scope_state_s()
let os_activity = _os_activity_create(dso, strdup("My Activity"), OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT)
os_activity_scope_enter(os_activity, &os_state)

os_log("fault message", type: .fault) // "My Activity" don't have one

os_activity_scope_leave(&os_state)

Later I found the activity with my message:

16:04:52.978940+0300    libsystem_trace.dylib   0   Activity for state dumps

So the system creates a special activity for that kind of messages (Tested on Mac/iOS).

But from the documentation (https://developer.apple.com/documentation/os/oslogtype/2320725-fault):

If an activity object exists, logging at this level captures information for the entire process chain.

And it's the same as for the error log level which is captured OK for custom activities.

Is a known issue or expected behaviour? I can't find any info about.

iUrii
  • 11,742
  • 1
  • 33
  • 48
  • from the [documentation](https://developer.apple.com/documentation/os/logging/collecting_log_messages_in_activities) it seems like they are calling a different func like os_log_fault not os_log. Did try that? – zombie Jul 29 '20 at 14:28
  • @zombie OSLog is limited on Swift and there are no that methods but you are right it's interesting to test on objc. – iUrii Jul 29 '20 at 14:32
  • Objc `os_log_fault` produces new activity as well so it's a common behaviour. – iUrii Aug 07 '20 at 08:03

0 Answers0