I'm creating logs using Apple's os.log
framework. I'm just making logs like:
os_log("Update: Lat: %{public}f | Long: %{private}f | RemainingTime: %{public}f ", log: log, type: .default, location.coordinate.latitude, location.coordinate.longitude, UIApplication.shared.backgroundTimeRemaining).
I do see the logs in console & debugger.
I've read this and I'm successfully able to download the container (just not sure if the container contains what I'm looking for or if this is the correct place to look at). Then I click on Show packages:
But after that I only see:
I looked into all files. The files just contained numbers like:
Should I be doing something extra or I'm looking in the wrong place?
EDIT1: After JAL's suggestion:
I looked into (Documents, Library, tmp). There are plist
and ktx
files. and function.data
& map.data
file.
I looked into these files:
and also these files:
I tried opening them with console but I get gibberish results like the image below:
EDIT2:
so first I didn't have permission to open /var/db/diagnostics
, I had to do sudo bash
. Then I did cd /var/db/diagnostics
and saw these files.
Events
FaultsAndErrors
Oversize
SpecialHandling
StateDumps
TTL
logdata.Persistent.20170724T212501.tracev3
logdata.Persistent.20170725T015616.tracev3
logdata.Persistent.20170725T134017.tracev3
logdata.Persistent.20170725T171020.tracev3
logdata.Persistent.20170725T213354.tracev3
logdata.Persistent.20170726T002702.tracev3
logdata.Persistent.20170726T144412.tracev3
logdata.Persistent.20170726T202128.tracev3
logdata.Persistent.20170727T021506.tracev3
logdata.Persistent.20170727T033929.tracev3
logdata.Persistent.20170727T075325.tracev3
logdata.Persistent.20170727T145233.tracev3
logdata.statistics.0.txt
logdata.statistics.1.txt
shutdown.log
Then I did open -a console logdata.Persistent.20170725T015616.tracev3
(I tried other .tracev3
files as well), but the console just opens and starts tracking realtime as if I just opened console normally...
You did not specify iOS, macOS, or tvOS in your question, so I am keeping my answer generic across all platforms.
Review WWDC 2016 - Session 721 - Unified Logging and Activity Tracing.
Logging data is stored in a new compressed binary format (.tracev3
or .logarchive
files), that's what those "numbers" are. You must use Console.app or the log
command line tool to open these files.
You're looking in the wrong place for the log files. From the session video:
Those files are now stored under /var/db/diagnostics with additional supporting files in /var/db/uuidtext. There are new tools to access that data, there's a new Console, a new log command line tool and one of the things you have to keep in mind is because the data is now stored in a binary format you must use the new tools to access it. So you can no longer grep through logs you have to use our tools to do the surfing through it.
There's also another new type of file the .logarchive, which is there for portability of log data. Essentially a .logarchive is a collection of information out of /var/db/diagnostics and you uuidtext collected together into a single file that's easier to transfer to email, to attach to bug reports and the like.
If you redirect stdout or stderr to a file (such as the code in this example), it should be in the Documents directory of your application's sandbox (or whatever directory you specified). Logs written to /var/db/diagnostics are generally unavailable to end users on iOS and tvOS.