Search code examples
pythonjenkinsjenkins-api

How to get and print Jenkins console output in Python script


I am trying to trigger a jenkins job using python script with jenkinsapi module.

import jenkinsapi
from jenkinsapi.jenkins import Jenkins
J = Jenkins('http://localhost:8080')
J.build_job('testjob')

I want to print console output from jenkins job which gets triggered with this in my python script. Can someone suggest me how can I achieve this?


Solution

  • I was able to resolve it with real time logs getting dumped into /var/lib/jenkins/jobs/#job_title#/builds/#build_id#