c++ - 从在 postgresql 上运行的 C++ 文件打印

标签 c++ c postgresql

我在 postgresql 中运行一些 C++ 代码。我正在尝试打印一些输出以跟踪执行情况,但没有结果。是否需要在某处添加任何内容才能使 printf 命令正常工作?我在我的代码中添加了下面提到的文件:

#include "postgres.h"

#include <math.h>
#include <limits.h>
#include <inttypes.h>

我要打印的内容:

printf("abc");

任何帮助将不胜感激,因为过去 2 天我一直在尝试获得一些输出。谢谢!

编辑:我正在使用 SSH 运行 postgresql 服务器。如果需要更多信息,请通过评论告诉我。

最佳答案

您需要使用 PostgreSQL 的内置日志系统:http://www.postgresql.org/docs/current/static/error-message-reporting.html

来自引用:

elog(INFO, "count=%d", count);

日志级别必须与您配置的 PostgreSQL 写入其日志文件的级别相匹配。

关于c++ - 从在 postgresql 上运行的 C++ 文件打印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22859236/

相关文章:

c++ - 处理对话框中的键盘输入 - Windows

C++ snprintf "cannot pass objects of non-POD type"

c - 使用 Makefile 进行简单编译?

取决于 gcc 开关的条件代码

sql - 如何使用子查询(或许通过横向连接)优化 sql 查询?

c++ - 如何在 C++ 中将 10 位映射到 6 位(尽可能高效)?

c++ - 从 tcp 读取 float

c - 如何使用 MinGW 为 MATLAB 2011 配置 mex

regex - 如何使用 regexp_matches 获取多个 mached 关键字

postgresql - PostgreSQL 错误 : right sibling's left-link doesn't match: block 5 links to 8 instead of expected 2 in index "pg_toast_2619_index"