2.3. Process Logging

Supervisor collects data from the STDOUT and STDERR file descriptors from the processes that it is controlling. This data can be read through the API.

2.3.1. supervisor.readProcessStdoutLog()

supervisor.readProcessStdoutLog(namespec, offset, length)

Table 2.33. supervisor.readProcessStdoutLog() Parameters

Type Name Description
string namespec Name of the group and process
integer offset Character offset to read from, with 0 being the first character of the log. See table below.
integer length Number of characters to read, or zero for all characters past the offset. See table below.

Table 2.34. supervisor.readProcessStdoutLog() Return Value

Type Description
string Excerpt from the log of the process

This method returns characters from a process' STDOUT log. It can either return the entire log, a number of characters from the tail of the log, or a slice of the log specified by offset and length:

Table 2.35. supervisor.readProcessLog() Offset and Length

offset length Behavior of supervisor.readProcessStdoutLog()
Negative Not Zero Bad arguments. This will raise the fault BAD_ARGUMENTS.
Negative Zero This will return the tail of the log, or offset number of characters from the end of the log. For example, if offset = -4 and length = 0, then the last four characters will be returned from the end of the log.
Zero or Positive Negative Bad arguments. This will raise the fault BAD_ARGUMENTS.
Zero or Positive Zero All characters will be returned from the offset specified.
Zero or Positive Positive A number of characters length will be returned from the offset.

If the log is empty and the entire log is requested, an empty string is returned.

If either offset or length is out of range, the fault BAD_ARGUMENTS will be returned.

If the log cannot be read (e.g. disk error), the fault FAILED will be returned.

[Note] Note

The readProcessStdoutLog() method replaces readProcessLog() found in Supervisor versions prior to 3.0a1. It is aliased for compatibility but readProcessLog() is deprecated and support will be dropped from Supervisor in a future version.

2.3.2. supervisor.readProcessStderrLog()

supervisor.readProcessStdoutLog(namespec, offset, length)

This method has the same behavior as supervisor.readProcessStdoutLog() except that it reads the log for the process' STDERR file descriptor.

2.3.3. supervisor.clearProcessLogs()

supervisor.clearProcessLogs(namespec)

Table 2.36. supervisor.clearProcessLogs() Parameters

Type Name Description
string namespec Name of the group and process

Table 2.37. supervisor.clearProcessLogs() Return Value

Type Description
boolean Always TRUE

This method clears the process’ STDOUT & STDERR logs (erases all content). If the logs cannot be cleared, the fault FAILED will be returned.

2.3.4. supervisor.clearAllProcessLogs()

supervisor.clearAllProcessLogs()

Table 2.38. supervisor.clearAllProcessLogs() Parameters

Type Name Description

Table 2.39. supervisor.clearProcessLogs() Return Value

Type Description
boolean Always TRUE

This method clears that STDOUT and STDERR logs of all processes under Supervisor's control. If the logs cannot be cleared, the fault FAILED will be returned.