Allow for custom log formats to be defined in stacker.yaml#705
Allow for custom log formats to be defined in stacker.yaml#705russellballestrini merged 1 commit into
Conversation
ejholmes
left a comment
There was a problem hiding this comment.
This seems pretty reasonable to me, and seems pretty common through the python world to be able to do this.
I'll let @phobologic do the final review, but I'm 👍
| @@ -0,0 +1,24 @@ | |||
| log_format_info: "[%(asctime)s] ${environment} custom log format - %(message)s" | |||
There was a problem hiding this comment.
In stacker.logger.setup_logging we also support color and debug keys. Should we just make this a nested structure?
Example
log_format:
info: "[%(asctime)s] ${environment} custom log format - %(message)s"
color: # Some color format
debug: # Some debug format
phobologic
left a comment
There was a problem hiding this comment.
This looks good to me - a few minor comments, and I wonder if we could have tests that actually test that the log formats are changing. Not sure that's super important though.
|
|
||
| tests/fixtures/blueprints/*-result | ||
|
|
||
| FakeKey.pem |
There was a problem hiding this comment.
Some other new test added testing for keys (#700), and it doesn't seem to clean up after itself. Since I run tests locally they show up in my repo after running make test.
|
|
||
| You may optionally provide a custom log format for stacker to use:: | ||
|
|
||
| # optional log format overrides. |
There was a problem hiding this comment.
Might be worth putting the defaults here, or at least explaining how we use the python logging module standard format variables (link to here? https://docs.python.org/2.7/library/logging.html#logrecord-attributes)
Docs and config model adjustment. modified: .gitignore modified: docs/config.rst modified: stacker/commands/stacker/__init__.py modified: stacker/commands/stacker/base.py modified: stacker/config/__init__.py modified: stacker/logger/__init__.py new file: stacker/tests/fixtures/not-basic.env new file: stacker/tests/fixtures/vpc-custom-log-format-info.yaml modified: stacker/tests/test_stacker.py
At Remind we run stacker on a large portion of our stacks in stage and production concurrently using continuous delivery. This means our logs are interlaced between stage and prod and are hard to use.
Also since we use continuous delivery we want to put the
deployment_idorgit commit hashon every log line so that we can aggregate them all up with our log parsing and viewing tools.This PR makes it possible to set a custom log format from
stacker.yaml.