[
https://issues.apache.org/jira/browse/CAMEL-25784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18128697#comment-18128697
]
Claus Ibsen commented on CAMEL-25784:
-------------------------------------
Two PRs, following kubectl logs --previous:
* [#28107|https://github.com/apache/camel/pull/28107] (camel-jbang): camel run
keeps its log when the run ends, as ~/.camel/<name>-previous.log with
<name>-previous.json (pid, end, exit code, the error). The next run of that
name replaces them, and at most the last 10 MB are kept. The log of a killed
process is kept under the name in its status file. camel log <name> --previous
prints it, and camel log of a name that is not running says how its previous
run ended.
* [#28108|https://github.com/apache/camel/pull/28108] (the AI tools, builds on
#28107): camel_run and camel_control restart now wait until the CamelContext
has started. They answered as soon as the status file appeared, which the CLI
connector writes while Camel starts, before the routes start. In a run of the
rest-code-first example the status file appeared at 1.74 s (state Initializing)
and the process exited at 2.82 s with exit code 70. camel_get_log of an
integration that is not running answers with the log of its previous run, and
camel_get_errors says how it ended.
_Claude Code on behalf of davsclaus_
> camel-jbang-mcp - the log of an app that stopped, such as one that failed at
> startup (like kubectl logs --previous)
> -------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-25784
> URL: https://issues.apache.org/jira/browse/CAMEL-25784
> Project: Camel
> Issue Type: Improvement
> Components: camel-jbang
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.24.0
>
>
> When an app stops, the AI tools can no longer read why. That hurts most when
> it fails at startup, as in a crash loop.
> In a benchmark of Oct 18-19 2026 (rest-code-first, a code-first REST DSL
> example), an app died at startup after a restart in 4 of the first 6 runs.
> {{camel_get_log}} and {{camel_get_errors}} then answered "No running Camel
> process matches 'contracts-rest-code-first'". The model restarted the app
> three times and never saw the error.
> The log is gone too: {{camel run}} writes {{~/.camel/<pid>.log}} and deletes
> it when the JVM ends ({{Run.runKameletMain}} cleans it up in a finally
> block), also when the start fails. And the next run has a new pid.
> The idea is what {{kubectl logs --previous}} gives for a container in a crash
> loop. Some ways to get there, to decide:
> # Keep the log of a run that ended with an error, or its last lines, by app
> name rather than pid (for example {{~/.camel/<name>-previous.log}}), replaced
> by the next run that ends.
> # {{camel_get_log}} and {{camel_get_errors}} take {{previous: true}}, or fall
> back to the previous run when no process matches the name, and say that it is
> the log of a run that stopped.
> # {{camel_run}} and {{camel_control restart}} wait a few seconds after the
> start and answer with the error and the log tail when the app did not start.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)