6

How do I Increase the log level of Fetchmail?

This seems stupidly easy but I can't find the directive and file I need anywhere on-line.

Nick
  • 4,656

3 Answers3

5

From fetchmail(1) (man 1 fetchmail):

Increasing verbosity of output:

   -v | --verbose
          Verbose mode.  All control messages passed between fetchmail and  the
          mailserver  are echoed to stdout.  Overrides --silent.  Doubling this
          option (-v -v) causes extra diagnostic information to be printed.

About debugging to syslog:

   The  --syslog option (keyword: set syslog) allows you to redirect status and
   error messages emitted to the syslog(3) system daemon  if  available.   Mes-
   sages are logged with an id of fetchmail, the facility LOG_MAIL, and priori-
   ties LOG_ERR, LOG_ALERT or LOG_INFO.  This option is  intended  for  logging
   status  and  error  messages which indicate the status of the daemon and the
   results while fetching mail from the server(s).  Error messages for  command
   line  options and parsing the .fetchmailrc file are still written to stderr,
   or to the specified log file.  The --nosyslog option turns off use  of  sys-
   log(3),  assuming  it’s turned on in the ~/.fetchmailrc file, or that the -L
   or --logfile <file> option was used.

Hope that helps!

Kyle Smith
  • 9,733
  • ooops, I think I forgot to mention that I'm running it as a daemon not from the command line. I'm getting logs in mail.info, but its not detailed enough. – Nick Feb 02 '12 at 19:42
  • Nick, it sounds like the --syslog option is working, but your syslog daemon is only logging high level messages (as expected). How to adjust this varies by what syslogging daemon you use. Can you get the output of ps aux|grep syslog and let me know the name of the process? Could be syslogd rsyslogd or other similiar names. – Kyle Smith Feb 03 '12 at 14:55
  • The process is "syslogd". (/sbin/syslogd) – Nick Feb 03 '12 at 17:09
  • For debugging, you should be able to tack a line into /etc/syslog.conf, like: mail.* /var/log/fetchmail_debug – Kyle Smith Feb 03 '12 at 18:00
  • There's a line already that says "mail.* -/var/log/mail.log". Do I replace that or add to it? – Nick Feb 05 '12 at 01:54
  • Then all logs from Fetchmail should be in /var/log/mail.log already. Nothing useful in there? – Kyle Smith Feb 06 '12 at 22:05
  • It said "authentication failed", or something similar, I was hoping I could get it to give more detail like whether SSL failed, or if the password was wrong, etc. Maybe that's all you can get from it. I fixed the problem I was having with Fetchmail, but I am still interested in making it more verbose for future debugging. – Nick Feb 07 '12 at 22:00
  • 1
    The problem being that fetchmail is crap. So, this verbosity setting is ONLY accessible via command-line parameter. I say it's crap as a user for almost 20 years. But it is. Everyone basically agrees. And just today (for this reason, and because verbose is just wrong, it's not fine-grained enough) I'm re-investigating getmail. Which has its latest release a few months ago, fetchmail's latest was 3 years ago... – Jürgen A. Erhard Feb 04 '17 at 15:15
  • @JürgenA.Erhard Thanks for the tip. Still no recent activity on fetchmail. What are your impressions of getmail vs fetchmail? Does getmail do fine-grained logging better than fetchmail? – nealmcb Oct 27 '18 at 21:01
3

at least in Debian you can also run

/etc/init.d/fetchmail debug-run

fetchmail will log directly to console and not fork into background

1

One way to increase verbosity of fetchmail when running it as a daemon is to add '-vv' to the fetchmail init script. For example, in Debian, add '-vv' to the OPTIONS parameter in /etc/init.d/fetchmail, restart fetchmail and then see the verbose output in /var/log/mail.log or /var/log/syslog.

PMM
  • 11