1

i need to debug a python script which is used in the exim transport pipe command. i already tried log_output but it logs only first line of the output returned by the python script which is a traceback error.

my_transport:
driver = pipe
command = /usr/bin/python /path/to/myscript.py
log_fail_output
group = mail
user = mail

i want to see full trackback error in mainlog in order to debug it. how to do that?

Tom Newton
  • 93
  • 1
  • 8
hebrew878
  • 53
  • 1
  • 4

2 Answers2

0

To add to @user9517's answer with the return_output directive, I'd like to share how I saw Exim log output on a RedHat based cPanel server:

  1. Turn off any monitoring or service restarts of Exim. E.g. cPanel servers have a 'Service Manager' that can stop restarts that would interfere with your debug run, as well as stop the service gracefully when you need to in a following step.
  2. Check how Exim normally runs for you:
ps aux | grep "exi[m]"
  1. Kill Exim, your command may be different from mine. (-9 is dangerous, know what you're doing)
kill -9 $( ps aux | grep "sbin\/exi[m]" )
  1. Start Exim in debug mode with -d, and save output to a file as well as STDIN if desired, your command may be different from mine. +all adds as much as possible AFAIK.
/usr/sbin/exim -d+all -ps -bd -q15m -oP /var/spool/exim/exim-daemon.pid 2&1 | tee ~/exim-debug.log
  1. See Exim's routing. This is just a handy one-liner to only show the successful routes taken.
cat ~/exim-debug.log | perl -0076 -ne '@x = $_ =~ /(^ ([^ ]*) .+? routed by \2 )/gs; $"="\n==========\n\n"; $cnt=0; for (@x){ print " -------->$_\n\n" unless $cnt % 2; $cnt++}'

The full log is where it mentions the child process.

grep -A15 'direct command' ~/exim-debug.log

The Exim mainlog also shows the result:

/var/log/exim_mainlog
Polo
  • 1
  • 1
0

You could try the return_output directive

return_output (pipe)

Type: boolean Default: false

If this option is true, and the command produced any output, the delivery is deemed to have failed whatever the return code from the command, and the output is returned in the delivery error message. Otherwise, the output is just discarded. However, if the message has a null sender (that is, it is a delivery error message), output from the command is always discarded, whatever the setting of this option.

user9517
  • 115,471
  • 20
  • 215
  • 297
  • i was looking for output to be logged in logfile. but i got command output in the bounce mail(undelivered mail returned to sender).its enough.thankyou – hebrew878 Feb 12 '14 at 08:20