Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log discriminator to separate log file when modernized plugin #29

Merged

Conversation

jonesbusy
Copy link
Collaborator

@jonesbusy jonesbusy commented Jun 22, 2024

Redirect all build logs to specific logger to avoid polluting the console logs and will simplify debugging, also ensure batch mode and remove transfer progress

Will create for example one log file per plugin and one for tool

Screenshot from 2024-06-22 10-48-47

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@jonesbusy jonesbusy added the enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted label Jun 22, 2024
@jonesbusy jonesbusy requested a review from sridamul June 22, 2024 08:49
@sridamul
Copy link
Contributor

ProcessBuilder.start(): pid: 42512, dir: E:\plugin-modernizer-tool\test-plugins\test-plugin-1, cmd: "cmd.exe" 
java.lang.RuntimeException: ProcessBuilder.start() debug
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1147)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089)
        at java.base/java.lang.Runtime.exec(Runtime.java:681)
        at org.apache.maven.shared.utils.cli.Commandline.execute(Commandline.java:390)
        at org.apache.maven.shared.utils.cli.CommandLineUtils.executeCommandLineAsCallable(CommandLineUtils.java:232)
        at org.apache.maven.shared.utils.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:172)
        at org.apache.maven.shared.utils.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:147)
        at org.apache.maven.shared.utils.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:125)
        at org.apache.maven.shared.utils.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:92)
        at org.apache.maven.shared.invoker.DefaultInvoker.executeCommandLine(DefaultInvoker.java:131)
        at org.apache.maven.shared.invoker.DefaultInvoker.execute(DefaultInvoker.java:97)
        at io.jenkins.tools.pluginmodernizer.core.impl.MavenInvoker.invokeGoals(MavenInvoker.java:115)
        at io.jenkins.tools.pluginmodernizer.core.impl.MavenInvoker.invokeGoal(MavenInvoker.java:41)
        at io.jenkins.tools.pluginmodernizer.core.impl.PluginModernizer.start(PluginModernizer.java:27)
        at io.jenkins.tools.pluginmodernizer.cli.Main.run(Main.java:63)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2030)
        at picocli.CommandLine.executeHelpRequest(CommandLine.java:2016)
        at picocli.CommandLine.executeHelpRequest(CommandLine.java:1987)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2272)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
        at picocli.CommandLine.execute(CommandLine.java:2174)
        at io.jenkins.tools.pluginmodernizer.cli.Main.main(Main.java:25)
[INFO] Scanning for projects...

I am getting this runtime exception and no logs are generated in the logs directory for plugins, it only contains modernizer.log file.

@jonesbusy
Copy link
Collaborator Author

jonesbusy commented Jun 22, 2024

Apparently it's caused by the --debug flag. I will check

@jonesbusy jonesbusy force-pushed the feature/sift-appender-for-plugin-logs branch from 294b225 to 54e720c Compare June 22, 2024 10:21
@jonesbusy
Copy link
Collaborator Author

jonesbusy commented Jun 22, 2024

This should be better now @sridamul

  • Console log is clean by default
  • modernizer.log contains the same data but with timestamps and formatted logs
  • <plugin.log> contains specific logs for plugin build using Markers

The --debug only change what is displayed related to console and application log

@sridamul
Copy link
Contributor

Hey @jonesbusy Everything looks great and perfectly works fine in my local environment, FYI still the runtime exception arises when --debug flag is enabled. Thanks!

@jonesbusy
Copy link
Collaborator Author

Hey @jonesbusy Everything looks great and perfectly works fine in my local environment, FYI still the runtime exception arises when --debug flag is enabled. Thanks!

My feeling is that is just a log of the java.lang.ProcessBuilderthat print some "normal" exception when DEBUG level is raised. So I think it's safe to merge. But I can investigate later

@jonesbusy jonesbusy merged commit 768d821 into jenkins-infra:main Jun 22, 2024
12 checks passed
@jonesbusy jonesbusy deleted the feature/sift-appender-for-plugin-logs branch June 22, 2024 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants