Skip to content

Commit

Permalink
DEBUG or SYSLOG testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lmangani authored Dec 3, 2024
1 parent 02ada4d commit 9837b7d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/httpserver_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ void HttpServerStart(DatabaseInstance& db, string_t host, int32_t port, string_t
string host_str = host.GetString();

const char* debug_env = std::getenv("DUCKDB_HTTPSERVER_DEBUG");
const char* use_syslog = std::getenv("DUCKDB_HTTPSERVER_SYSLOG");

if (debug_env != nullptr && std::string(debug_env) == "1") {
global_state.server->set_logger([](const duckdb_httplib_openssl::Request& req, const duckdb_httplib_openssl::Response& res) {
auto now = std::chrono::system_clock::now();
Expand All @@ -396,6 +398,17 @@ void HttpServerStart(DatabaseInstance& db, string_t host, int32_t port, string_t
res.status);
fflush(stdout);
});
} else if (use_syslog != nullptr && std::string(use_syslog) == "1") {
openlog("duckdb-httpserver", LOG_PID | LOG_NDELAY, LOG_LOCAL0);

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_amd64, x86_64, x64-osx)

use of undeclared identifier 'LOG_PID'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_amd64, x86_64, x64-osx)

use of undeclared identifier 'LOG_NDELAY'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_amd64, x86_64, x64-osx)

use of undeclared identifier 'LOG_LOCAL0'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_amd64, x86_64, x64-osx)

use of undeclared identifier 'LOG_PID'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_amd64, x86_64, x64-osx)

use of undeclared identifier 'LOG_NDELAY'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_amd64, x86_64, x64-osx)

use of undeclared identifier 'LOG_LOCAL0'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_arm64, arm64, arm64-osx)

use of undeclared identifier 'LOG_PID'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_arm64, arm64, arm64-osx)

use of undeclared identifier 'LOG_NDELAY'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_arm64, arm64, arm64-osx)

use of undeclared identifier 'LOG_LOCAL0'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_arm64, arm64, arm64-osx)

use of undeclared identifier 'LOG_PID'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_arm64, arm64, arm64-osx)

use of undeclared identifier 'LOG_NDELAY'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_arm64, arm64, arm64-osx)

use of undeclared identifier 'LOG_LOCAL0'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_mvp, wasm32-emscripten)

use of undeclared identifier 'LOG_PID'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_mvp, wasm32-emscripten)

use of undeclared identifier 'LOG_NDELAY'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_mvp, wasm32-emscripten)

use of undeclared identifier 'LOG_LOCAL0'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_mvp, wasm32-emscripten)

use of undeclared identifier 'LOG_PID'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_mvp, wasm32-emscripten)

use of undeclared identifier 'LOG_NDELAY'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_mvp, wasm32-emscripten)

use of undeclared identifier 'LOG_LOCAL0'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'LOG_PID'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'LOG_NDELAY'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'LOG_LOCAL0'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'LOG_PID'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'LOG_NDELAY'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'LOG_LOCAL0'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'LOG_PID'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'LOG_NDELAY'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'LOG_LOCAL0'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_threads, wasm32-emscripten)

use of undeclared identifier 'LOG_PID'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_threads, wasm32-emscripten)

use of undeclared identifier 'LOG_NDELAY'

Check failure on line 402 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_threads, wasm32-emscripten)

use of undeclared identifier 'LOG_LOCAL0'
global_state.server->set_logger([](const duckdb_httplib_openssl::Request& req, const duckdb_httplib_openssl::Response& res) {
syslog(LOG_INFO, "%s %s - %d",

Check failure on line 404 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_amd64, x86_64, x64-osx)

use of undeclared identifier 'LOG_INFO'

Check failure on line 404 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_amd64, x86_64, x64-osx)

use of undeclared identifier 'LOG_INFO'

Check failure on line 404 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_arm64, arm64, arm64-osx)

use of undeclared identifier 'LOG_INFO'

Check failure on line 404 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_arm64, arm64, arm64-osx)

use of undeclared identifier 'LOG_INFO'

Check failure on line 404 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_mvp, wasm32-emscripten)

use of undeclared identifier 'LOG_INFO'

Check failure on line 404 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_mvp, wasm32-emscripten)

use of undeclared identifier 'LOG_INFO'

Check failure on line 404 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'LOG_INFO'

Check failure on line 404 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'LOG_INFO'

Check failure on line 404 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'LOG_INFO'

Check failure on line 404 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_threads, wasm32-emscripten)

use of undeclared identifier 'LOG_INFO'
req.method.c_str(),
req.path.c_str(),
res.status);
});
std::atexit([]() {
closelog();

Check failure on line 410 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_amd64, x86_64, x64-osx)

use of undeclared identifier 'closelog'

Check failure on line 410 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_amd64, x86_64, x64-osx)

use of undeclared identifier 'closelog'

Check failure on line 410 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_arm64, arm64, arm64-osx)

use of undeclared identifier 'closelog'

Check failure on line 410 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / MacOS (osx_arm64, arm64, arm64-osx)

use of undeclared identifier 'closelog'

Check failure on line 410 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_mvp, wasm32-emscripten)

use of undeclared identifier 'closelog'

Check failure on line 410 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_mvp, wasm32-emscripten)

use of undeclared identifier 'closelog'

Check failure on line 410 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'closelog'

Check failure on line 410 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'closelog'

Check failure on line 410 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_eh, wasm32-emscripten)

use of undeclared identifier 'closelog'

Check failure on line 410 in src/httpserver_extension.cpp

View workflow job for this annotation

GitHub Actions / Build extension binaries / DuckDB-Wasm (wasm_threads, wasm32-emscripten)

use of undeclared identifier 'closelog'
});
}

const char* run_in_same_thread_env = std::getenv("DUCKDB_HTTPSERVER_FOREGROUND");
Expand Down

0 comments on commit 9837b7d

Please sign in to comment.