Set the fax log level to possibly resend failed faxes

Oct 02, '08 07:30:00AM

Contributed by: xr4ti

OS X uses a disappointingly convoluted set of programs and preferences to send a fax. Trying to debug why a particular fax isn't getting through to a particular machine is frustrating, since Apple doesn't provide any help at all. If you happen to stumble upon it, you may see the CUPS log file in /var/log/cups/error_log, which may contain error messages about your failed fax. You can also see this file by opening the log from the fax printer queue (if you made one).

I've found that the Apple OS X fax formats aren't particularly compatible with a number of other fax recipients -- I sometimes get repeated errors in /var/log/cups/error_log that look like this:

E [date time] [Job 53] There was a fax protocol error.
E [date time] PID 352 (/usr/libexec/cups/backend/fax) stopped with status 1!
I [date time] Hint: Try setting the LogLevel to "debug" to find out more.
But that leaves you wondering "how do I set LogLevel to debug?"

I wrote the following script to help get that done; it allows you to toggle between normal and debug mode for the LogLevel setting:

#!/bin/zsh

if [ $# -ne 1 ]; then
    echo 'USAGE:  faxlog [ debug | normal ]'
    exit
fi
if [ $EUID -ne 0 ]; then
    echo YOU MUST SUDO TO ROOT TO RUN THIS
    exit
fi
if [ $1 = 'debug' ]; then
    echo saving current cupsd.conf
    mv /etc/cups/cupsd.conf /etc/cups/cupsd.conf.current
    echo changing LogLevel to debug
    sed -e 's/^LogLevel.*/LogLevel debug/' /etc/cups/cupsd.conf.current > /etc/cups/cupsd.conf
    chmod 644 /etc/cups/cupsd.conf
    echo restarting cupsd
    launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist
    launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
elif [ $1 = 'normal' ]; then
    if [ -r /etc/cups/cupsd.conf.current ]; then
        echo moving cupsd.conf.current back to cupsd.conf
        mv /etc/cups/cupsd.conf.current /etc/cups/cupsd.conf
        echo restarting cupsd
        launchctl unload /System/Library/LaunchDaemons/org.cups.cupsd.plist
        launchctl load /System/Library/LaunchDaemons/org.cups.cupsd.plist
    else
        echo /etc/cups/cupsd.conf.current does not exist
        exit
    fi
else
    echo 'USAGE:  faxlog [ debug | normal ]'
    exit
fi
I named my script faxlog, and it's then called using this command in Terminal (remember to make it executable via chmod a+x faxlog):
$ sudo faxlog [option]
Replace [option] with either debug or normal. It's set up to preserve changes you might have made to the default cupsd.conf, but keep in mind it only preserves them when you are in the normal configuration.

What I've found is that the debug information (which goes into /var/log/cups/error_log) is not as useful as the act of setting the debug setting itself. Most of the time, I set debug, and the fax goes through without an error. I suspect that this is because the debug setting adds some sort of delay, and the delay causes the Apple fax software to succeed. Apple has probably chosen some parameter that isn't compatible with many fax machines (my faxes fail with about 30% of the machines I've tried to communicate with).

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080929093843474