apache-age代码中的print语句的输出打印在哪里?

问题描述 投票:0回答:2

我已经在 apache-age 代码中进行了更改,现在我想确认我的更改 通过使用 print 语句。但是当我使用简单的 printf() 时,它没有反映出来 在 PostgreSQL 日志文件中。

但是如果我在 apache-age repo

中使用以下代码
ereport(WARNING, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                errmsg("Statement is %s",varname)));

然后它会反映 PostgreSQL 日志以及 psql 终端中的输出, 但这也会打印一些额外的警告语句。

如何打印简单的语句而不发出警告?

postgresql cypher apache-age
2个回答
0
投票

您通过给语句提供警告状态代码来打印语句。通过使用不同的状态代码,您可以在其他日志类下打印语句。

您将在 elogs.h 头文件下找到 postgres 使用的错误代码。如果您使用了 postgres 的默认安装路径,您将在以下位置找到它:

/usr/local/pgsql/include/server/utils/elog.h

以下是该文件下定义的一些错误代码。您可能会发现

NOTICE
对您想要做的事情很有用。

/* Error level codes */
#define DEBUG5      10          /* Debugging messages, in categories of
                                 * decreasing detail. */
#define DEBUG4      11
#define DEBUG3      12
#define DEBUG2      13
#define DEBUG1      14          /* used by GUC debug_* variables */
#define LOG         15          /* Server operational messages; sent only to
                                 * server log by default. */
#define LOG_SERVER_ONLY 16      /* Same as LOG for server reporting, but never
                                 * sent to client. */
#define COMMERROR   LOG_SERVER_ONLY /* Client communication problems; same as
                                     * LOG for server reporting, but never
                                     * sent to client. */
#define INFO        17          /* Messages specifically requested by user (eg
                                 * VACUUM VERBOSE output); always sent to
                                 * client regardless of client_min_messages,
                                 * but by default not sent to server log. */
#define NOTICE      18          /* Helpful messages to users about query
                                 * operation; sent to client and not to server
                                 * log by default. */
#define WARNING     19          /* Warnings.  NOTICE is for expected messages
                                 * like implicit sequence creation by SERIAL.
                                 * WARNING is for unexpected messages. */

0
投票

ereport(DEBUG1, (errmsg("语句为 %s", varname)));

© www.soinside.com 2019 - 2024. All rights reserved.