Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal errors are being marked as "warning" when using --log-format json #3603

Closed
thisiscab opened this issue Jul 20, 2021 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@thisiscab
Copy link

Describe the bug

When hitting a RuntimeException exception, the logs are being marked as "warning"

Steps To Reproduce

The easiest way to reproduce this error is to run dbt --log-format json run in a project that doesn't contain a dbt_project.yml file

Expected behavior

The level of the log should be increased to either "error", "critical" or "fatal".
Please note that I'm not familiar with log levels that you folks are using, but it's sure shouldn't be marked as "warning".

Screenshots and log output

root@02a28c7a6c62:/usr/src# dbt --log-format json run
{"timestamp": "2021-07-20T22:01:10.129503Z", "message": "Running with dbt=0.19.1", "channel": "dbt", "level": 11, "levelname": "INFO", "thread_name": "MainThread", "process": 1156, "extra": {"run_state": "internal"}}
{"timestamp": "2021-07-20T22:01:10.129928Z", "message": "Encountered an error:", "channel": "dbt", "level": 13, "levelname": "WARNING", "thread_name": "MainThread", "process": 1156, "extra": {"run_state": "internal"}}
{"timestamp": "2021-07-20T22:01:10.130108Z", "message": "Runtime Error\n  fatal: Not a dbt project (or any of the parent directories). Missing dbt_project.yml file", "channel": "dbt", "level": 13, "levelname": "WARNING", "thread_name": "MainThread", "process": 1156, "extra": {"run_state": "internal"}}

System information

Which database are you using dbt with?
NOT RELEVANT

The output of dbt --version:

root@02a28c7a6c62:/usr/src# dbt --version
installed version: 0.19.1
   latest version: 0.20.0

Your version of dbt is out of date! You can find instructions for upgrading here:
https://docs.getdbt.com/docs/installation

Plugins:
  - snowflake: 0.19.1

The operating system you're using:

(Debian 10.10)

The output of python --version:

root@02a28c7a6c62:/usr/src# python --version
Python 3.8.11

Additional context

We're using a monitoring platform where we're sending the DBT logs to and allow us to visualize problems, but the logs are incorrectly marked as warning and our systems are set up such that warnings are not triggering an alert while other log levels are.

When there is a fatal error, we want to be aware of it and be notified ASAP and currently, there isn't a good way to achieve this due to the current log level of "fatal errors".

@thisiscab thisiscab added bug Something isn't working triage labels Jul 20, 2021
@jtcohen6
Copy link
Contributor

@thisiscab Thanks for opening! I totally agree.

More broadly, this is on our radar already ahead of releasing dbt v1.0 later this year: #3359. We want to make sure that we're able to offer structured logging, with reliable log levels, for observation by orchestration tools and monitoring platforms. I see resolving an inconsistency like this one to be squarely in the scope of that effort.

@jtcohen6
Copy link
Contributor

This will be fixed in v1.0.0, thanks to our ongoing work on structured logging:

$ dbt run
11:15:47 | [ info  ] | Running with dbt=1.0.0-rc1
11:15:47 | [ error ] | Encountered an error:
Runtime Error
  fatal: Not a dbt project (or any of the parent directories). Missing dbt_project.yml file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants