pack: fetch logs from managed instance on error (CRAFT-333)
Metadata
Current evaluation
Merged changes to retrieve managed instance logs upon charm packing failures. Introduces a log path interface, provider log capture method, and log prefixing. Approved by two reviewers and passed CI.
Suggested action: —
No scores available.
Issue body
Catch error when failing to pack a Charm, retrieving the logs from
the managed instance for easier inspection by the user.
- Update logger to write to /tmp/charmcraft.log so that it can be
readily retrieved by the host Charmcraft instance. Provide this
path with a new env.get_managed_environment_log_path() interface.
Additionally, ensure the log file is truncated with mode='w' so
the instance logs are only for the last run.
- prefix logs in managed instance with "mm "
- add providers.capture_logs_from_instance() to providers to retrieve
logs and send them to logger.debug()
- update build to use this mechanism
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged changes to retrieve managed instance logs upon charm packing failures. Introduces a log path interface, provider log capture method, and log prefixing. Approved by two reviewers and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Adds error handling to fetch logs from managed instances when Charm packing fails. Updates the logger to write to /tmp/charmcraft.log, introduces a provider log retrieval method, and prefixes logs with mm. Merged after minor formatting feedback. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #12 providers: retrieve data from instance log file (CRAFT-589) | rockcraft | merged | Merged implementation to retrieve instance log data upon provider execution completion and append it to external logs. Uses craft-cli predictable naming and sets library logs to debug level. Approved, rebased on main, and merged. |