JagLockNoWaitCollection  JagNewCollection

Chapter 5: C Routines Reference

JagLog

Description

Write a message to the server’s log file.

Syntax

#include <jagpublic.h>

JagStatus JagLog(
                 JagBoolean use_date, 
                 SQLPOINTER logmsg)

Parameters

use_date

Pass as JAG_TRUE to indicate that the message should be preceded by a timestamp in the log; pass as JAG_FALSE to log the message without a timestamp.

logmsg

A null-terminated string containing the message to be logged. The message must include a newline at the end.

Returns

Return value

To indicate

JAG_SUCCEED

Success.

JAG_FAIL

Failure. JagLog fails if the log file can not be opened or if logmsg is NULL. If the log file cannot be opened, log messages are written to the server process’ standard error device.

Usage

JagLog writes a message to the server’s log file.

By convention, errors that occur on the server are written to the log. C or C++ components should use JagLog to record error messages in the log rather than printing to the console.

You can call JagSendMsg to send error messages to the client. When a method invocation fails you should log any details that will help debug the cause of failure, then send a descriptive error to the client.

For information on configuring the log file used by the server, see Chapter 3, “Creating and Configuring Servers,” in the EAServer System Administration Guide.

See also

JagSendMsg

Appendix C, “Creating C Components,” in the EAServer Programmer’s Guide.





Copyright © 2005. Sybase Inc. All rights reserved. JagNewCollection