ADC Home > Reference Library > Technical Q&As > Printing > Hardware & Drivers >
Not Recommended Document
Important: The information in this document is Not Recommended and should not be used for new development.
Current information on this Reference Library topic can be found here:
Technical Q&A QA1182
Why does logging keep my Printer Module from working?
Why does logging keep my Printer Module from working? This used to work fine in Mac OS X 10.0 and 10.1.
Unlike in previous versions of Mac OS X,
in Mac OS X 10.2 (Jaguar) the printing system (CUPS) makes use of
to route information between modules.
Any code in a Printer Module (PM) or I/O Module (IOM) that
tries to log to
printf, etc., will
interfere with the printing system. If you must write to
a log file, use
fprintf to write to a specific file or send
your log information to
stderr. See Listing 1 for examples.
// Write to /private/var/log/cups/error_log
fprintf( stderr, "This message will appear in the CUPS error log." );
// Write to your own log file
fprintf( file, "This message will appear in your own log file" );
Listing 1. Logging examples
Be aware that on Jaguar your PMs and IOMs run as
daemon and not the currently logged in user, so if you are logging to a
file via fprintf you'll need to set the appropriate permissions on the destination
As an additional debugging aid, you can adjust the logging level for the CUPS "error_log"
file by editing the CUPS configuration file "/etc/cups/cupsd.conf" and changing
LogLevel. Listing 2 shows the relevant
section from "cupsd.conf" that you will need to edit.
# LogLevel: controls the number of messages logged to the ErrorLog
# file and can be one of the following:
# debug2 Log everything.
# debug Log almost everything.
# info Log all requests and state changes.
# warn Log errors and warnings.
# error Log only errors.
# none Log nothing.
Listing 2. Controlling the "error_log" logging level from "cups.conf"
[Nov 06 2002]