Here it is.

diff -Naur qmail-1.03.orig/qmail-pop3d.c qmail-1.03/qmail-pop3d.c
- --- qmail-1.03.orig/qmail-pop3d.c	Sat Feb 24 14:26:54 2001
+++ qmail-1.03/qmail-pop3d.c	Sat Feb 24 22:52:55 2001
@@ -41,6 +41,9 @@
 char ssinbuf[128];
 substdio ssin = SUBSTDIO_FDBUF(saferead,0,ssinbuf,sizeof ssinbuf);
 
+char sserrbuf[128];
+substdio sserr = SUBSTDIO_FDBUF(safewrite,2,sserrbuf,sizeof
sserrbuf);
+
 void put(buf,len) char *buf; int len;
 {
   substdio_put(&ssout,buf,len);
@@ -53,8 +56,25 @@
 {
   substdio_flush(&ssout);
 }
+void writelog(char *x1, char *x2, char *x3, char *x4)
+{
+  char strnum[FMT_ULONG];
+  
+  strnum[fmt_ulong(strnum,getpid())] = 0;
+    
+  substdio_puts(&sserr,"pop3d: pid ");
+  substdio_puts(&sserr,strnum);
+  substdio_puts(&sserr," ");
+  if (x1) substdio_puts(&sserr,x1);
+  if (x2) substdio_puts(&sserr,x2);
+  if (x3) substdio_puts(&sserr,x3);
+  if (x4) substdio_puts(&sserr,x4);
+  substdio_puts(&sserr,"\n");
+  substdio_flush(&sserr);
+}
 void err(s) char *s;
 {
+  writelog("-ERR ", s, 0, 0);
   puts("-ERR ");
   puts(s);
   puts("\r\n");
@@ -193,6 +213,7 @@
 	rename(m[i].fn,line.s); /* if it fails, bummer */
       }
   okay();
+  writelog("QUIT", 0, 0, 0);
   die();
 }
 
@@ -257,6 +278,7 @@
   int i;
   unsigned long limit;
   int fd;
+  char strnum[FMT_ULONG];
  
   i = msgno(arg);
   if (i == -1) return;
@@ -271,6 +293,8 @@
   substdio_fdbuf(&ssmsg,read,fd,ssmsgbuf,sizeof(ssmsgbuf));
   blast(&ssmsg,limit);
   close(fd);
+  strnum[fmt_ulong(strnum,m[i].size)] = 0;
+  writelog("RETR: ", "msglen: ", strnum, 0);
 }
 
 struct commands pop3commands[] = {
diff -Naur qmail-1.03.orig/qmail-popup.c qmail-1.03/qmail-popup.c
- --- qmail-1.03.orig/qmail-popup.c	Mon Jun 15 12:53:16 1998
+++ qmail-1.03/qmail-popup.c	Sat Feb 24 22:52:55 2001
@@ -38,6 +38,9 @@
 char ssinbuf[128];
 substdio ssin = SUBSTDIO_FDBUF(saferead,0,ssinbuf,sizeof ssinbuf);
 
+char sserrbuf[128];
+substdio sserr = SUBSTDIO_FDBUF(safewrite,2,sserrbuf,sizeof
sserrbuf);
+
 void puts(s) char *s;
 {
   substdio_puts(&ssout,s);
@@ -46,8 +49,25 @@
 {
   substdio_flush(&ssout);
 }
+void writelog(char *x1, char *x2, char *x3, char *x4)
+{
+  char strnum[FMT_ULONG];
+  
+  strnum[fmt_ulong(strnum,getpid())] = 0;
+  
+  substdio_puts(&sserr,"popup: pid ");
+  substdio_puts(&sserr,strnum);
+  substdio_puts(&sserr," ");
+  if (x1) substdio_puts(&sserr,x1);
+  if (x2) substdio_puts(&sserr,x2);
+  if (x3) substdio_puts(&sserr,x3);
+  if (x4) substdio_puts(&sserr,x4);
+  substdio_puts(&sserr,"\n");
+  substdio_flush(&sserr);
+}
 void err(s) char *s;
 {
+  writelog("-ERR ", s, 0, 0);
   puts("-ERR ");
   puts(s);
   puts("\r\n");
@@ -67,7 +87,7 @@
 void err_authoriz() { err("authorization first"); }
 
 void okay() { puts("+OK \r\n"); flush(); }
- -void pop3_quit() { okay(); die(); }
+void pop3_quit() { okay(); writelog("QUIT", 0, 0, 0); die(); }
 
 
 char unique[FMT_ULONG + FMT_ULONG + 3];
@@ -88,7 +108,14 @@
   int wstat;
   int pi[2];
  
- -  if (fd_copy(2,1) == -1) die_pipe();
+  /* Don't know why this is needed has no effect when removed
+     it stands in the way of good logging with multilog
+     checked qmail-pop3d it does not use the fd 2
+     it only writes to stdout not stderr not even for errors
+     Willy De la Court <Willy.DelaCourt@pandora.be>
+   */
+  
+  /* if (fd_copy(2,1) == -1) die_pipe();*/
   close(3);
   if (pipe(pi) == -1) die_pipe();
   if (pi[0] != 3) die_pipe();
@@ -140,6 +167,7 @@
   seenuser = 1;
   if (!stralloc_copys(&username,arg)) die_nomem(); 
   if (!stralloc_0(&username)) die_nomem(); 
+  writelog("USER: ", arg, 0, 0);
 }
 void pop3_pass(arg) char *arg;
 {
@@ -153,6 +181,7 @@
   space = arg + str_chr(arg,' ');
   if (!*space) { err_syntax(); return; }
   *space++ = 0;
+  writelog("APOP: ", arg, 0, 0);
   doanddie(arg,space - arg,space);
 }
 

