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

Turn off cache logging when --log-cache-events is not set #1139

Closed
drewbanin opened this issue Nov 16, 2018 · 2 comments
Closed

Turn off cache logging when --log-cache-events is not set #1139

drewbanin opened this issue Nov 16, 2018 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@drewbanin
Copy link
Contributor

Issue

Issue description

dbt has a --log-cache-events flag, but it appears that some invocations of dbt log the cache events even when this is flag not provided. Cache events should only be logged when --log-cache-events is provided.

Results

--log-cache-events was not provided, but cache events were logged to logs/dbt.log

This happened for both dbt run and dbt archive, though it may apply to other types of invocations as well.

System information

The output of dbt --version:

0.12.1

The operating system you're running on:
Amazon Linux

The python version you're using (probably the output of python --version)
3.5

Steps to reproduce

TBD. In the logs I have which demonstrates this, I see:

running dbt with arguments Namespace(cls=, debug=False, log_cache_events=False, profile='user', profiles_dir='/tmp/jobs/508650/.dbt', strict=False, target='prod', threads=None, use_cache=True, vars='{}', which='archive')

followed by parsing, and then:

On master: select
table_name as name, table_schema as schema, table_type as type
from information_schema.tables
where table_schema ilike 'analytics'
SQL status: SUCCESS 70 in 1.15 seconds
Adding relation: _CachedRelation(schema=ANALYTICS, identifier=XXX, inner="ANALYTICS"."XXX")
before adding: {'ANALYTICS.XXX': [],
'ANALYTICS.YYY': [],
'ANALYTICS.ZZZ': [],
@drewbanin drewbanin added the bug Something isn't working label Nov 16, 2018
@drewbanin drewbanin added this to the Grace Kelly milestone Nov 16, 2018
@beckjake
Copy link
Contributor

This is another issue around calling handle_and_check twice (see #1138) / bypassing dbt's logging machinery. If you never call dbt.logging.initialize_logger, the cache logger will propagate by default due to how python works.

The safest solution here is to flip that flag during handle_and_check based on the given arguments, instead of during one-time logger initialization.

beckjake added a commit that referenced this issue Nov 20, 2018
…y-issues

Fix run repeatability/caching issues (#1138, #1139, #1140)
@beckjake
Copy link
Contributor

Fixed in #1144

dbeatty10 added a commit to dbt-labs/docs.getdbt.com that referenced this issue Jan 30, 2024
[Preview](https://docs-getdbt-com-git-dbeatty-log-cache-events-config-dbt-labs.vercel.app/reference/global-configs/logs#logging-relational-cache-events)

resolves #4664

## What are you changing in this pull request and why?

As noted in #4366, there is currently not any documentation for the
`log_cache_events` config.

When `True`, this flag enables verbose logging for [relational
cache](https://docs.getdbt.com/reference/global-configs/cache) events
(which can be helpful when debugging) (default to `False`).

Because it has existed since at least
[2018-11-15](dbt-labs/dbt-core#1139) (prior to
dbt v1.0), no version blocks are applicable.

## Checklist
- [x] Review the [Content style
guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md)
so my content adheres to these guidelines.
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