I am using Jenkins for CI - and want to be able to expose the logs so we don't have to telnet onto the CI box to see what's going on.
Is there a plugin that will do this? Or should I just need to write a script?
I am using Jenkins for CI - and want to be able to expose the logs so we don't have to telnet onto the CI box to see what's going on.
Is there a plugin that will do this? Or should I just need to write a script?
My answer is about reading application server/container log files from different boxes than Jenkins is running on. For example, if you use Jenkins to build your wars and then deploy them to several environments and you want to read the log files from your Jenkins CI server without having to manually ssh/telnet the other boxes.
You can create a Jenkins Project/job that will do that for you, after creating the Jenkins project you will find the Configure option and inside that there is an option in the Build section where you can write a shell script:
Your script can be something like this:
Or something more complex, for example passing parameters before building the Jenkins Job so your users can select which environment and log file they want to see, there is an option called "This build is parameterized" that you can select and add your parameters:
With that configuration the user will see something like this when trying to build the project:
The shell script can use those params like this:
After building the Job they can see the output from the logs in the Jenkins Job Console for example:
If your log files are too long maybe you can use "tail" instead of "cat" in the script.
You can create logs during the build and attache them as an artifact however the jenkins core does not allow you to save the console log to the workspace. If you want to save the console log you will need to install the ConsoleLogToWorkspace plugin. This plugin will give you the ability to save the entire jenkins console log.
If you mean the general output of a Jenkins build, this is available via the web UI for each build, under the "Console Output" link.
If you mean a specific log file generated in the workspace during the build, you can choose the "Archive the artifacts" option in the "Post-build steps" section of your job configuration.
There you can specify a file pattern, e.g.
**/*.log
.Any files in the workspace matching that pattern will be archived at the end of each build, and will be visible on the build's web page.
Note that the build will fail if no files match this pattern.