Apache HTTP 服务器 - 如何在模块上打印到控制台?

Apache HTTP Server - How to print to console on modules?

我有一个名为 mod_mymodule.so 的 Apache HTTP 服务器模块,遵循文档 here

我真的很想看看我自己的 std::cout,所以我可以在 运行 的时间内看到我的模块正在加载以及里面发生了什么,例如:

static int myserver_handler(request_rec *r)
{
    std::cout << "WHY CAN'T I SEE THIS ON THE TERMINAL????" << std::endl; // <----????
    return OK;
}

static void register_hooks(apr_pool_t *pool)
{
    ap_hook_handler(myserver_handler, NULL, NULL, APR_HOOK_LAST);
}

module AP_MODULE_DECLARE_DATA   tofserver_module =
{
    STANDARD20_MODULE_STUFF,
    NULL,            // Per-directory configuration handler
    NULL,            // Merge handler for per-directory configurations
    NULL,            // Per-server configuration handler
    NULL,            // Merge handler for per-server configurations
    NULL,            // Any directives we may have for httpd
    register_hooks   // Our hook registering function
};

运行 Apache 在调试模式下将输出到终端:

sudo apache2ctl -X