1

I'm using the DuckDB CLI, version 1.4.2 on macOS.

The plan is to use duckdb as a part of a CLI pipeline, not from inside of a Python script, etc.

I've already got the tooling to build out the script to run from the command line. However, what I'd like to do is export any errors encountered for further attention.

I've gone through the logging documentation, and it sounds straightforward. However, I've not found a way to get errors to show up in the logs. Here's a stand-alone example:

CALL enable_logging(['HTTP','FileSystem','Metrics','PhysicalOperator','QueryLog'],level = 'WARN');

CALL enable_logging(level = 'debug'); -- I've tried other levels, no change in behavior.

create table pets (
    id       uuid default uuidv7(),
    species  text,
    name     text);
    
create view pet_view AS SELECT idd,species,name from pets;

Now, if you're in the CLI, you'll get an error here as I've deliberately typed a field name wrong:

Binder Error:
Referenced column "idd" not found in FROM clause!
Candidate bindings: "id"

LINE 1: create view pet_view AS SELECT idd,species,name from pets;                   ^

However, the error never shows up in the log.

⚫◗ select * from duckdb_logs();
┌────────────┬──────────────────────┬──────────┬───────────┬───────────────────────────────────────────────────────────────────────────────────────────────┐
│ context_id │      timestamp       │   type   │ log_level │                                            message                                            │
│   uint64   │ timestamp with tim…  │ varchar  │  varchar  │                                            varchar                                            │
├────────────┼──────────────────────┼──────────┼───────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤
│         23 │ 2025-12-09 10:38:1…  │ QueryLog │ INFO      │ CALL enable_logging(level = 'debug'); -- I've tried other levels, no change in behavior.      │
│         27 │ 2025-12-09 10:38:1…  │ QueryLog │ INFO      │ create table pets (\n    id       uuid default uuidv7(),\n    species  text,\n    name     …  │
│         31 │ 2025-12-09 10:38:1…  │ QueryLog │ INFO      │ create view pet_view AS SELECT idd,species,name from pets;                                    │
│         33 │ 2025-12-09 10:38:4…  │ QueryLog │ INFO      │ select * from duckdb_log();                                                                   │
└────────────┴──────────────────────┴──────────┴───────────┴───────────────────────────────────────────────────────────────────────────────────────────────┘

I've tried several things with no improvement:

  • Stream the log output directly to a file.
  • Changed the logging level.
  • Specifically added every supported LogType that I can find in the source code.
  • Quitting and restarting duckdb between changes.

Logging errors for review is such a basic feature, I'm pretty sure that I'm missing something pretty obvious, can anyone suggest what that might be?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.