10 messages in net.sourceforge.lists.courier-usersRe: [courier-users] Log courier-imap
FromSent OnAttachments
Andre CoetzeeJun 16, 2004 5:15 am 
Sam VarshavchikJun 16, 2004 4:37 pm 
Andre CoetzeeJun 17, 2004 9:33 am 
Sam VarshavchikJun 17, 2004 5:05 pm 
Andre CoetzeeJun 21, 2004 11:05 am 
Sam VarshavchikJun 21, 2004 3:24 pm 
AnaJun 22, 2004 5:03 am 
cour...@gmx.netJun 22, 2004 5:52 am 
AnaJun 22, 2004 6:14 am 
Andre CoetzeeJun 22, 2004 10:14 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [courier-users] Log courier-imapActions...
From:cour...@gmx.net (cour@gmx.net)
Date:Jun 22, 2004 5:52:43 am
List:net.sourceforge.lists.courier-users

--On Dienstag, 22. Juni 2004 14:09 +0200 Ana <ana@udc.es> wrote:

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

hello! I've postfix+courier-imap 3.0 on a Solaris 9 machine. I'd like courier-imap log in another file different from syslog, but I'm not able. I've modified logger.c to this:

# ifdef LOG_MAIL { "mail", LOG_LOCAL3 }, # endif and in my syslog.conf

local3.* /var/log/courier.log

but it doesn't work. Any idea?

No, but you probably just got the wrong line...

The following patch allows to set the facility via the config-file for each courier-daemon individually:

# cat logger-facility-0.45.4.patch # set facility via LOG_FACILITY --- ../courier-0.45.4.orig/tcpd/logger.c Sun Aug 19 00:20:53 2001 +++ tcpd/logger.c Sat Apr 10 18:44:44 2004 @@ -14,7 +14,10 @@ #include "unistd.h" #endif #if HAVE_SYSLOG_H +#include <stdlib.h> +#define SYSLOG_NAMES #include <syslog.h> +#undef SYSLOG_NAMES #endif

static const char rcsid[]="$Id: logger.c,v 1.3 2001/08/16 01:38:43 mrsam Exp $"; @@ -22,11 +25,31 @@ int main(int argc, char **argv) { char buf[512]; -char *p; -int c; +char *p, *f_name; +int c, i; +int f_val=LOG_MAIL; // default

if (argc < 2) return (1);

+/* +** PATCH: adjust logging output via env LOG_FACILITY, may be set to: +** auth,authpriv,cron,daemon,ftp,kern,lpr,mail,news,sysslog,user,uucp +** local0,local1,local2,local3,local4,local5,local6,local7 +*/ +#if HAVE_SYSLOG_H + if( (f_name=getenv("LOG_FACILITY")) != NULL && *f_name ) + { + for (i=0; facilitynames[i].c_name; i++) + { + if (!strcmp(f_name, facilitynames[i].c_name)) + { + f_val = facilitynames[i].c_val; + break; + } + } + } +#endif + #if TESTMODE

#else @@ -38,7 +61,8 @@ | LOG_NOWAIT #endif

- , LOG_MAIL); + , f_val); + close(1); close(2); open("/dev/null", O_WRONLY);