16.10 - Initiate Log Stream - Parallel Transporter

Teradata Parallel Transporter Operator Programmer Guide

prodname
Parallel Transporter
vrm_release
16.10
created_date
May 2017
category
Programming Reference
featnum
B035-2435-057K

Purpose

Initiate Log Stream is used for initiating a log stream. The message catalog name is supplied in the Teradata PT script to make the Log View Server or Log View Client generate the messages. The logging facility itself does not use the message catalog.

Structure

#include <pxoper.h>
PXSTC_Code PX_LogInit(PX_OperatorHandle  oprhandle,
   char  *componentname,
   PX_Number  instancenumber 
   char  *outputlogreport,
   PX_ErrorProc   errorproc,
   PX_LogHandle *loghandle);

where the following is true:

Parameter Function Specification
componentname input Name of the component.
instancenumber input Number of the operator instance.
loghandle output Handle to the log stream, allocated by the Logger API.

The caller is responsible for passing the address of a PX_LogHandle pointer to PX_LogInit, but the Logger API is responsible for allocating the structure.

errorproc input Pointer to the function to be called if an error occurs in the Logger API, or NULL if no specific error handling is wanted.
oprhandle input Handle to the operator.
outputlogreport input Name of the private log report, or NULL, if the log report is public.

The outputlogreport parameter may contain an explicit character value, for example, PrivateFileName, or it may be NULL. If NULL is specified, the log becomes PUBLIC.

Return Codes

The following Initiate Log Stream function status codes are defined by the Teradata PT operator interface.

Status Code Signifies
PXSTC_Success The call succeeded.
PXSTC_LogInsuff MemError Memory allocation failure.
PXSTC_CatalogError No message catalog specified.
PXSTC_Log CommunicationError Error from socket communication with the Node Logger.
PXSTC_LogPassword The Logger API has supplied a wrong password for the logger (indicates an attempt to access the logger without using the supplied API).
PXSTC_InvalidData Type The type of some of the parameters is unknown to the Logger API.
PXSTC_NoMessage Catalog The requested message catalog is not present.
PXSTC_Unknown Error Unknown initialization error.

Define additional Initiate Log Stream function status codes as required to support your operator.

Usage Notes

Consider the following when defining the Initiate Log Stream function.

Topic Usage Note
Status If the function status is PXSTC_Success, the message catalog for the operator was successfully initialized by this function.
See Also

Example - Initiate Log Stream

#include <pxoper.h>
PX_ErrorProc  myerror;
PX_Operator oprhandle;
PX_LogHandle *loghandle;
.
.
.
PX_Initiate(PX_Operator oprhandle)
{
.
.
.
.
/* Initiate a public log stream for instance 75
of "mycomponent". */
PX_LogInit(oprhandle,"mycomponent", 75, NULL, myerror, &loghandle);
.
/* Initiate a private log stream named "myreport" for instance 75 of "mycomponent". */
PX_LogInit (oprhandle, "mycomponent", 75, "myreport", myerror, &loghandle);
.
.
/* Initiate a private log stream named using user defined Teradata Parallel Transporter script attribute  */
/* (PrivateLogName) for instance 75 of "mycomponent". */
PX_GetAttribute(oprhandle, "PrivateLogName", (PX_AttributeValue *)&value, &length);
PX_LogInit (oprhandle, "mycomponent", 75, value, myerror, &loghandle);
.
.
}