Redirect AGI Script output

Is there any way to redirect all output from an AGI script to some file?
I tried like:

AGI(/path/to/ >> /tmp/debug.log 2>&1)

But thats not working. Any suggestions?

Thank you!

You would have to do that within the script itself. (Or in a wrapper script.)

I actually tried a wrapper script but it kills the i/o. Cant hear anything, cant send tones etc.

Ended up just putting it into the script

class Logger(object):
  def __init__(self):
    self.terminal = sys.stdout
    self.log = open('/tmp/debug.log', 'a')
  def write(self, message):
  def flush(self):
sys.stdout = Logger()
sys.stderr = Logger()

Per AGI/application/system log files are evil. For several reasons.

syslog() is your friend.

I guess if you change AGI by shell(), that could work, not sure but test it, but that will remove some valuables features only present on AGI command

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.