-
Notifications
You must be signed in to change notification settings - Fork 11
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
improve log by adding the jobname as context #41
Conversation
Codecov Report
@@ Coverage Diff @@
## master #41 +/- ##
==========================================
+ Coverage 98.98% 99.00% +0.01%
==========================================
Files 23 23
Lines 198 201 +3
Branches 19 19
==========================================
+ Hits 196 199 +3
Misses 1 1
Partials 1 1
Continue to review full report at Codecov.
|
@@ -40,23 +40,26 @@ public BuildHistoryManager(List<Rule> rules) { | |||
*/ | |||
@Override | |||
public synchronized void perform(Job<?, ?> job) throws IOException, InterruptedException { | |||
String uniquePerformName = job.getFullName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
full name or display name ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
full name, else you cannot distinguish two projects with the same display name in different folders
} | ||
|
||
Run<?, ?> run = job.getLastCompletedBuild(); | ||
// for each completed build... | ||
while (run != null) { | ||
LOG.info("Processing build #" + run.getNumber()); | ||
LOG.info(uniquePerformName + ": Processing build #" + run.getNumber()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this method is synchronized I don't think there is value to pass this into each log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
synchronized only for each instance's execution or am I wrong?
so there is the possibility that two different instances/projects are analyzed in parallel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but then you have two separate logs - is that right?
I'm not good at case which you currently having so that's why I'm asking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no this is not the console output of the current build, this is part of the system log.
if you want to log to the console output you need a RunListener and call getLogger() on that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -17,7 +17,7 @@ public static Job buildSampleJob() { | |||
|
|||
public static Job buildSampleJob(Run lastBuild) { | |||
Job job = mock(Job.class); | |||
|
|||
when(job.getFullName()).thenReturn("sampleJob"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why if you don't validate it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if nothing is configured getFullName()
returns null which will result in the code crashing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On concatinating the log output.
Besides that in the "real world" this is never null
@theKBro can you share the configuration for this - I see that I haven't tested the plugin against such case :( |
just create multiple jobs, I did not do anything special here |
so this change satisfy Jenkins global log but project log where the plugin runs is fine even without this change? |
then I don't see valuable of having this change merged as Jenkins log is rather for debugging plugin issue and problem with configuration can be found at particular job execution even without this change |
Correct me if i'm wrong, but nothing is and was ever logged to job execution's console log? Or where can I find it? |
No description provided.