Checklist
- [x] Checked if it requires a pylibjuju change?
- [ ] Added integration tests for the PR?
- [x] Added or updated doc.go related to packages changed?
- [ ] Do comments answer the question of why design decisions were made?
Description of change
We have been logging both stdout and stderr for units at DEBUG, but that
leaves everything at debug. And while we want to stop including DEBUG by default, we do want to include things like Tracebacks by default. However those are written to stderr.
So we can split the logging, and log all of stdout to DEBUG and stderr to
WARNING.
This also fixes the default logging level, which had been "logger.LoggerInfo()"
which defaults to <root>=WARNING and sets it to what we intended it to be
<root>=INFO.
QA steps
sh
$ juju bootstrap lxd lxd
$ juju model-config logging-config
<root>=INFO
$ juju model-config -m controller logging-config
<root>=INFO
# Edit a charm to inject a python exception
$ juju deploy broken-charm
$ juju debug-log --include broken-charm/0 --replay
</root></root>
That should show lines something like:
unit-uo-0: 01:12:30 INFO juju.worker.uniter awaiting error resolution for "install" hook
unit-uo-0: 01:13:54 INFO juju.worker.uniter awaiting error resolution for "install" hook
unit-uo-0: 01:13:54 WARNING unit.uo/0.install Traceback (most recent call last):
unit-uo-0: 01:13:54 WARNING unit.uo/0.install File "/var/lib/juju/agents/unit-uo-0/charm/dispatch", line 14,in <module>
unit-uo-0: 01:13:54 WARNING unit.uo/0.install import broken
unit-uo-0: 01:13:54 WARNING unit.uo/0.install ModuleNotFoundError: No module named 'broken'
unit-uo-0: 01:13:54 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) f
</module>
Documentation changes
We should note the change in behavior for logging.
Bug reference
https://bugs.launchpad.net/juju/+bug/1893993
该提问来源于开源项目:juju/juju