Technology > Apple

Summary. The Apple Console utility allows viewing of various log files.

Archives. Important log files typically have backup archives made of them. For example, by default, the System.log file is archived (turned over) every day at midnight (assuming your computer is on) and then a fresh System.log file is created. This creates eight handy daily files so you can go back about a week to view system events. The resulting archive files are in bz2 format, and if you choose File > Save a copy as… from the Console program, the resulting file will be in bz2 format.

BZ2 Compression. The BZ2 is a 15-year old compression standard uses a very complex compression algorithm. The file format “consists of a 4-byte header, followed by zero or more compressed blocks, immediately followed by an end-of-stream marker containing a 32-bit CRC…” [source]

The Simple Solution. At least for system.log files that are in the bz2 format, the quick solution is to change the filename to be something like system-0.log and then open the file with Text Edit.

The Long Explanation. Below Greg Johnson explains the long discovery process that resulted in the simple solution below.

“When trying to expand and open bz2 files, the Apple Archive Utility seemed to produce an endless loop of expanding files. When I double clicked on system.log.0.bz2 it would be expanded to system.log.0.bz2.cpgz. When I double clicked on system.log.0.bz2.cpgz it would be expanded to system.log.0.bz2. And this kept repeating.

Given the complexity of file compression algorithms, I knew I’d need an advanced utility to open my System.log files that had been archived into bz2 file format.So, I tried Stuffit Expander, but that couldn’t even open the file. Then I tried StuffIt Destinations, and it also failed to open the file. I tried iUnarchive, but it didn’t work either. Finally I tried Pacifist. It gave me the message, ‘The document ‘system.log.0.bz2′ could not be opened.’ I then tried using Pacifist to open the cpgz file and that worked, and Pacifist would allow me to view the file contents. Yet, I was still mystified.

On a hunch, and purely from an intuitive guess, I wondered what would happen if I changed the system.log.0.bz2 filename to simply be system0.log instead. Then, I tried opening that with Text Edit. It worked fine! How frustrating. Why does Console put a compressed file extension on a file that’s basically a text file?

%d bloggers like this: