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

Update DEBUG_LOG_FORMAT to correctly zero-pad the microsecond portion #2099

Merged
merged 1 commit into from
Feb 10, 2020
Merged

Update DEBUG_LOG_FORMAT to correctly zero-pad the microsecond portion #2099

merged 1 commit into from
Feb 10, 2020

Conversation

heisencoder
Copy link
Contributor

Currently, when running dbt with the --debug flag, the microsecond portion of the timestamp does not have leading zeros, which causes jagged formatting. Example:

2020-02-05 22:56:50,953988 (MainThread): Parsing macros/materializations/...
2020-02-05 22:56:50,989795 (MainThread): Parsing macros/materializations/...
2020-02-05 22:56:51,48211 (MainThread): Partial parsing not enabled
2020-02-05 22:56:51,80875 (MainThread): Acquiring new bigquery connection "model.mytable".
2020-02-05 22:56:51,81005 (MainThread): Opening a new connection, currently in state init
2020-02-05 22:56:51,883792 (MainThread): Acquiring new bigquery connection "model.bar".

The fix was to just paste in the text of the TODO immediately above DEBUG_LOG_FORMAT in logger.py.

However, if that wasn't working for some other reason, another fix would be to modify DEBUG_LOG_FORMAT like this:

logger.py:
  DEBUG_LOG_FORMAT = (
    #'{record.time:%Y-%m-%d %H:%M:%S%z}.{record.time.microsecond:06} '

(i.e., change the '03' to a '06' so that 6 digits are zero-padded instead of just 3).

(I also took the liberty to change the European ',' decimal point to an American '.' decimal point.)

@cla-bot cla-bot bot added the cla:yes label Feb 5, 2020
Copy link
Contributor

@beckjake beckjake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm into all this! I've got some scripts that parse dbt logs that I'll have to update, but that's probably worth it. I've kicked off the tests, and when they pass we will merge this for 0.16.0

@heisencoder
Copy link
Contributor Author

Thanks!

@drewbanin
Copy link
Contributor

drewbanin commented Feb 10, 2020

@beckjake merge at will :)

Thanks @heisencoder!

@drewbanin drewbanin added this to the Barbara Gittings milestone Feb 10, 2020
@beckjake beckjake merged commit 2eea89a into dbt-labs:dev/barbara-gittings Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants