logging messages to error_log with "INFO:" does not work

Helge Blischke h.blischke at srz.de
Tue Jul 4 05:31:13 PDT 2006


Kurt Pfeifle wrote:
>   ------------------------------------------------------------------
>   (This happens likewise on a Debian testing system cupsys 1.1.23-15
>   as it does on a self-compiled system from Subversion trunk/r5706)
>   ------------------------------------------------------------------
> 
> I'm trying to get the log level INFO to work with a self-written 
> backend (a shell script to create a special type of PDFs).
> 
> My understanding is this: if I create output to stderr prepended
> with the keywords "INFO:", "NOTICE:", "WARNING:", "DEBUG:",
> "DEBUG2:", "CRIT:", "ERROR:", "ALERT:" or "EMERG:" then my output
> should appear in the error_log (with the first character of the
> line being "I", "N", "W", "D", "d", "C", "E", "A" or "X".
> 
> Well, it works for all levels as described -- but not for "INFO:" 
> 
> So my question is: What is different for "LogLevel info"? Is this a
> bug? Or do I miss something obvious?
> 
> 
> Here is the sample "dummy" backend I used for testing:
> 
> ----------------- snip ------------------------------------------------
>   #!/bin/bash
>   # 
>   # /usr/lib/cups/backend/dummy
>   #
>   # (by Kurt Pfeifle)
>   #
>   # This dummy backend writes the file to the path given as device URI
>   # "dummy:/path/to/output/file" (where the respective directories need
>   # to be already in existence)
>   
>   case ${#} in
>      0)
>         echo "file dummy \"Unknown\" \"Dummy backend to test logging\""
>         exit 0
>         ;;
>      1|2|3|4)
>         echo "Usage: dummy job-id user title copies options [file]"
>         exit 0
>         ;;
>      5)
>         cat - > ${DEVICE_URI#dummy:}
>         ;;
>      6)
>         cat ${6} > ${DEVICE_URI#dummy:}
>   esac
>   
>   echo "EMERG:  This is a \"emergency\" level log message" 1>&2
>   echo "ALERT:  This is a \"alert\" level log message"     1>&2
>   echo "CRIT:   This is a \"critical\" level log message"  1>&2
>   echo "ERROR:  This is a \"error\" level log message"     1>&2
>   echo "WARN:   This is a \"warn\" level log message"      1>&2
>   echo "NOTICE: This is a \"notice\" level log message"    1>&2
>   echo "INFO:   This is a \"info\" level log message"      1>&2
>   echo "DEBUG:  This is a \"debug\" level log message"     1>&2
>   echo "DEBUG2: This is a \"debug2\" level log message"    1>&2
> ----------------- snap ------------------------------------------------
> 
> Cheers,
> Kurt
> 
> 
> P.S.: For other readers wanting to test it, do this:
>       a) copy the sample to /usr/lib/cups/backend/dummy
>       b) make it executable: "chmod a+x /usr/lib/cups/backend/dummy"
>       c) restart cupsd
>       d) install a printer: "lpadmin -p dummyprn -v dummy:/dev/null -E"
>          (be careful: if you do use a *real* file path+name instead of 
>          /dev/null, it will be overwritten!)
>       e) print: "lp -d dummyprn /etc/hosts"
>       f) see error_log: "tail -n 20 /var/log/cups/error_log"
> 

At least in CUPS 1.1.x, the INFO messages are written to the error_log only if
the log level is at least warning or notice (don't know exactly). With log level
info, the latest info message is saved as the state message in the internal printer's
structure (and dumped inot printers.conf, shown in the web interface, or with the
lpstat command).

I currently don't know if things have changed with 1.2.x.

Helge


-- 
Helge Blischke
Softwareentwicklung
SRZ Berlin | Firmengruppe besscom
http://www.srz.de




More information about the cups mailing list