Sun Java System Messaging Server 6 2005Q4 MTA Developer's Reference


Write diagnostic output to the channel’s log file.


void mtaLogv(const char *fmt
             va_list     ap);





Pointer to a printf() formatting string. The string must be NULL terminated. See your platform’s C run-time library documentation for information on the formatting substitutions accepted by printf().


A va_list structure as defined by the system stdarg.h header file.


The mtaLogv() routine is provided for programs that either need to provide a diagnostic interface accepting a va_list() argument, or want to provide some generalization of mtaLog(). Use of mtaLogv() ensures that diagnostic output is directed to the same output stream as other diagnostic information generated by the MTA SDK.

With one exception, consider a call to mtaLogv() as being identical to calling the C run-time library routine vprintf(). The call arguments for the two routines are identical including the formatting argument, fmt. The single exception is that, unlike vprintf(), a call to mtaLogv() always produces a single line of output to the channel’s log file. Consequently, do not attempt to write either partial or multiple lines with a single call to mtaLogv().

Do not include a terminating line feed or other record terminator in the output. That is, do not put a \n at the end of the formatting string.

Return Values



The following code fragment demonstrates a way to provide a generalization of mtaLog() using mtaLogv().

#include <stdarg.h>

void ourLog(our_context_t *ctx, const char *fmt, ...)
   char new_fmt[10240];
   va_list ap;

    * Genrate a new formatting string that includes as a prefix
    * the value of ctx-\>id then followed by the contents of the
    * supplied formatting string.
   snprintf(new_fmt, sizeof(new_fmt),
            "id=%d; %s", ctx-\>id, fmt);
   va_start(ap, fmt);
   mtaLogv(new_fmt, ap);