Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
2.2 agent logging override #7525
Conversation
howbazaar
added some commits
Jun 12, 2017
wallyworld
approved these changes
Jun 21, 2017
Please add a validation check for any agent config value supplied.
| MaxSize: 300, // megabytes | ||
| MaxBackups: 2, | ||
| Compress: true, | ||
| } | ||
| + if loggingOverride := config.Value(agent.LoggingOverride); loggingOverride != "" { |
wallyworld
Jun 21, 2017
Owner
There's a Validate() function for agent config - can we add validation there that any supplied config parses etc
howbazaar
Jun 21, 2017
Owner
The rationale behind not adding the logging override to the Validate function is that it is entirely a debugging option, and any value that is set will be checked when the agent starts anyway, and if it doesn't work, an error will be omitted there. Adding another logged error seems a bit pointless.
| + loggo.DefaultContext().ResetLoggerLevels() | ||
| + err := loggo.ConfigureLoggers(loggingOverride) | ||
| + if err != nil { | ||
| + logger.Errorf("setting override %v", err) |
| + loggo.DefaultContext().ResetLoggerLevels() | ||
| + err := loggo.ConfigureLoggers(loggingOverride) | ||
| + if err != nil { | ||
| + logger.Errorf("setting override %v", err) |
| + if logger.configOverride != "" { | ||
| + log.Debugf("overriding model config %q with override from agent.conf %q", loggingConfig, logger.configOverride) | ||
| + loggingConfig = logger.configOverride | ||
| + // If we are overriding the logging config value, there is no error. |
wallyworld
Jun 21, 2017
Owner
Why not do this block fist. Set loggingConfig to logger.configOverride and then if empty, read from api. Will be much simpler IMO.
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
howbazaar commentedJun 21, 2017
Description of change
If there are many units in a model, it is not always desirable to enable debug mode for the entire model while attempting to resolve issues or work out why things aren't working. This branch introduces an agent config file option that allows overriding of the model logging config so a single agent can log at specified severity levels different to the model.
QA steps
Bootstrap a model and deploy a unit.
SSH into the unit and edit the agent.conf file to specify
LOGGING_OVERRIDE=juju=debug
In the values section.
Restart the agent
Observer the continued debug logging in juju debug-log.
Documentation changes
Probably worth adding a section to the troubleshooting section of the docs.