[ 
https://issues.apache.org/jira/browse/CAMEL-25832?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-25832.
---------------------------------
    Resolution: Fixed

> camel-jbang - camel run with the quarkus, spring-boot or main runtime keeps 
> no log of the previous run
> ------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25832
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25832
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jbang
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.24.0
>
>
> CAMEL-25784 keeps the log of a run that ended as 
> {{~/.camel/<name>-previous.log}}, with {{<name>-previous.json}} (pid, when it 
> ended, exit code, signal, failure). {{camel log <name> --previous}} prints 
> it, and the AI tools of the camel-jbang-mcp server read it when the app is 
> gone. This covers {{camel run}} with the default runtime (KameletMain).
> The Maven runtimes keep no log of the previous run. Each of them handles the 
> log of a run in another way ({{Run.java}}):
> * {{--runtime=quarkus}}: the exported project logs to {{~/.camel/<name>.log}} 
> ({{quarkus.log.file.path}}). When camel run ends, the log is deleted (the 
> {{ChildProcess.stopOnExit}} callback in {{runQuarkus}}).
> * {{--runtime=main}}: logs to {{~/.camel/<name>.log}}. The log is deleted 
> when the run starts ({{writeCamelMainRunLogConfig}}) and when it ends 
> ({{runCamelMain}}).
> * An existing Camel Main project: the log is deleted when the next run starts 
> ({{writeCamelMainRunLogConfig}}), not when the run ends.
> * An existing Quarkus project: the same ({{Files.deleteIfExists}} before the 
> Maven command).
> * {{--runtime=spring-boot}}, exported or an existing project: logback logs to 
> {{~/.camel/<pid>.log}} ({{spring-boot-logback.xml}}), with the pid of the 
> Spring Boot JVM. camel run does not delete it. After CAMEL-25784, the next 
> camel run of the default runtime keeps it as the previous run only when the 
> app was killed and its status file is still there. Otherwise it deletes the 
> log after a day, or {{camel dirty --clean}} does.
> So when an app on a Maven runtime fails at startup, {{camel log --previous}} 
> and the tools have nothing to read once camel run has ended, or once the app 
> runs again.
> Proposal: keep the log as the previous run ({{PreviousRun.keep}}) where it is 
> deleted today:
> * in the {{stopOnExit}} callbacks of the export runs (quarkus, main);
> * when an existing project run starts and the log of the last run is still 
> there;
> * for Spring Boot, log to {{<name>.log}} as the other runtimes do, so the log 
> can be kept the same way.
> Notes:
> * The exit code of {{mvn}} is not the exit code of the app: with quarkus:dev 
> and spring-boot:run, the app runs in a child process of Maven. The status 
> file of the app ({{<pid>-status.json}}) has the pid of the app.
> * The name of the run is the {{appName}} that camel run uses for the log file 
> today.
> Follow-up of CAMEL-25784.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to