PutString Method (MessageLog object)



This method sends a message to the object’s associated message log.

To specify additional message attributes, such as severity, use the MessageLog2.SendLogMessage method.


object.PutString Message

The PutString method syntax has these parts:




An object expression that evaluates to a MessageLog object.


A string containing the message to be sent to the message log.


When messages are sent with this method they are given a message ID of 0 representing an unformatted (not localized) message. The message, when it is received by the logging system, is time stamped using UTC by the system where the message is stored. This means when sending a message from a PI-SDK node to a Server’s MessageLog, if the time clocks differ, the time logged for the message will be the server’s time. This time, when retrieved with a call to MessageLog.List, is retrieved as UTC and converted on the PI-SDK node to local time according to the time zone and DST settings on the PI-SDK machine.

If the message subsystem associated with the object (either the local PI-SDK message subsystem or the destination Server’s message subsystem) is down or not accessible, starting with version messages are written to the Windows Application Event log.  Previously messages were written to the “pipc.log” file in the “dat” subdirectory of the machine’s PIPC directory. A machine's PIPC directory is identified in the pipc.ini file in the Windows directory under the section [PIPC] and the item PIHome or PIPCShare. The PIPCShare item overrides any PIHome setting.

Trappable Errors

In addition to generic errors (such as Out of Memory), the following errors may occur:




Failed to post the message to the log. See the description for more details.


Failed to translate the passed string (BSTR) to an internal PIstring.


The MessageLog object did not have its parent set correctly internally.


Unable to create an internal message user object.


Unable to open the local or server’s message file.

Enabling Operational Intelligence