Well, that’s exciting. It seems that CFNetwork diagnostics has only partially made the jump to the unified logging system that we added in iOS 10 and friends. You should definitely file bugs requesting support for the specific use cases that you care about. I’ve filed my own bugs against QA1887 (r. 29024477) and CFNetwork diagnostic itself (r. 29024490).
As things currently stand it is possible to get at the logs via sysdiagnose. Here’s what I did:
I ran my app with
CFNETWORK_DIAGNOSTICS
set to 3.I ran a simple NSURLSession task in order to generate some logging.
I grabbed a sysdiagnose, per the instructions on the Profiles and Logs page.
I used
log
to filter the sysdiagnose for CFNetwork diagnostic messages.
Here’s an example of what I saw:
$ log show --start '2016-10-31 11:00:00' --predicate 'eventMessage BEGINSWITH "CFNetwork Diagnostics"' /Users/quinn/Library/Logs/CrashReporter/MobileDevice/Vanderspool/DiagnosticLogs/sysdiagnose/sysdiagnose_2016.10.31_11-12-28+0000/system_logs.logarchive
==========
/Users/quinn/Library/Logs/CrashReporter/MobileDevice/Vanderspool/DiagnosticLogs/sysdiagnose/sysdiagnose_2016.10.31_11-12-28+0000/system_logs.logarchive
==========
Skipping info and debug messages, pass --info and/or --debug to include.
Filtering the log data using "eventMessage BEGINSWITH "CFNetwork Diagnostics""
Timestamp Thread Type Activity PID
2016-10-31 11:01:40.995453+0000 0x2538f2 Default 0x0 2498 QTestbed: (CFNetwork) CFNetwork Diagnostics [3:1] 11:01:40.990 {
LoaderWhatToDo: (null)
Request: <CFURL 0x1700ccbe0 [0x1b4f41bb8]>{string = https://forums.developer.apple.com/, encoding = 134217984, base = (null)}
CachePolicy: 1
WhatToDo: originload
CreateToNow: 0.00222s
} [3:1]
…
--------------------------------------------------------------------------------------------------------------------
Log - Default: 163, Info: 0, Debug: 0, Error: 0, Fault: 0
Activity - Create: 0, Transition: 0, Actions: 0
You should be able to do similar things with the new Console app in macOS 10.12, although I haven’t tried that myself yet.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"