hpcups does not provide PAGE: messages for CUPS page logging

Asked by martin_jacobs

I've CUPS 1.3.11 and HPLIP 3.9.10 installed and running.

One motivation to switch from LPRnG to CUPS was it's built in accounting, especially page logging. Now I found out that my page_log file remains empty, although all print queues are regularily installed using current ppd files provided by HPLIP.

After some investigation I learned that page logging is triggered by PAGE: <num> <num> messages written by filter chain to stderr and then processed by cupsd. Furthermore last filter in chain is hpcups and hpcups does not write such DEBUG messages. Is that something that can be configured during compile time? Or is this issue already on HPLIP's road map?

BR / Martin

Question information

Language:
English Edit question
Status:
Open
For:
HPLIP Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
martin_jacobs (martin-jacobs) said :
#1

What I found out so far is this:

- We've to look at whole process chains built out-of multiple filters and one backend process.
- hplip uses hp as backend
- hplip writes PAGE: 1 1 if and only if file descriptor fd is not zero (hp.c):

      if (fd != 0)
      {
         fputs("PAGE: 1 1\n", stderr);
         lseek(fd, 0, SEEK_SET);
      }

- hplip sets fd to zero if argc equals 6 (hp.c)
   if (argc == 6)
   {
      fd = 0; /* use stdin. */
      copies = 1;
   }
That means backend hp does not write PAGE: messages to cupsd if operating in normal cups environment.

- cups' job.c sets argv[6] to NULL after first filter process is started. That makes sense because argv[6] is a pointer to print job source file and only first filter needs to know about that. All other processes build a filter chain reading from stdin and writing to stdout. It's cupsd's task to connect processes and pipes the right way.

taken from job.c of cups 1.3.11, lines 3382ff
   cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Started filter %s (PID %d)",
                    job->id, command, pid);

    argv[6] = NULL;
    slot = !slot;
  }
This looks the same in job.c taken from 1.4.2 ( * "$Id: job.c 8801 2009-08-29 06:05:14Z mike $" )

IMHO backend hp is not compatible with current cups implementation.

Suggestion: move fputs(...) in front of if (fd != 0) { ... }:

      fputs("PAGE: 1 1\n", stderr);
      if (fd != 0)
      {
         /* start reading from beginning of given file */
         lseek(fd, 0, SEEK_SET);
      }

BR / Martin

Can you help with this problem?

Provide an answer of your own, or ask martin_jacobs for more information if necessary.

To post a message you must log in.