Re: Is it possible to log to console for a parameter plugin?

2019-12-15 Thread Oleg Nenashev
Sorry, "patch"

On Sun, Dec 15, 2019, 12:05 Andrew Sumner  wrote:

> What do you mean by "create a path to the Jenkins core..."?
>
> On Sunday, 15 December 2019 18:24:02 UTC+13, Oleg Nenashev wrote:
>>
>> Hi Andrew,
>>
>> Some APIs have been created before the logging framework, and they might
>> be lacking logger references. ParameterValue is unfortunately one of the
>> examples of such old APIs, AFAICT there is no clean API to reference the
>> listener.
>> My recommendation would be to just create a path to the Jenkins core and
>> to route parameters correctly.
>>
>> I believe the listener can be still retrieved using reflection, but I do
>> not have example for it
>>
>> On Saturday, December 14, 2019 at 1:41:17 PM UTC+1, Andrew Sumner wrote:
>>>
>>> I am writing a custom parameter using the 
>>> SimpleParameterDefinition/ParameterValue
>>> classes
>>>
>>> Is it possible to log to the console in buildEnvironment method?
>>>
>>> @Override
>>> public void buildEnvironment(Run build, EnvVars env) {
>>>  env.put("VAR1", var1Value);
>>>  env.put("VAR2", var2Value);
>>> }
>>>
>>> For example, in a SimpleBuildStep I would use the TaskListener
>>>
>>> @Override
>>> public void perform(Run run, FilePath workspace, Launcher launcher, 
>>> TaskListener listener) {
>>>  listener.getLogger().println("About to do some stuff");
>>> }
>>>
>>> but I cannot find a similar option in for parameters.
>>>
>>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-dev/luE_ASVLB1U/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> jenkinsci-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/5178aa8a-cacb-4899-8d5d-0fac0bd1c2f9%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAPfivLAtNk%3DY%2BaEf7NGQH9p4qXVcrYbBB6DzQnwD1FDW-oLXhw%40mail.gmail.com.


Re: Is it possible to log to console for a parameter plugin?

2019-12-15 Thread Andrew Sumner
What do you mean by "create a path to the Jenkins core..."?

On Sunday, 15 December 2019 18:24:02 UTC+13, Oleg Nenashev wrote:
>
> Hi Andrew,
>
> Some APIs have been created before the logging framework, and they might 
> be lacking logger references. ParameterValue is unfortunately one of the 
> examples of such old APIs, AFAICT there is no clean API to reference the 
> listener. 
> My recommendation would be to just create a path to the Jenkins core and 
> to route parameters correctly.
>
> I believe the listener can be still retrieved using reflection, but I do 
> not have example for it
>
> On Saturday, December 14, 2019 at 1:41:17 PM UTC+1, Andrew Sumner wrote:
>>
>> I am writing a custom parameter using the 
>> SimpleParameterDefinition/ParameterValue 
>> classes
>>
>> Is it possible to log to the console in buildEnvironment method?
>>
>> @Override
>> public void buildEnvironment(Run build, EnvVars env) {
>>  env.put("VAR1", var1Value);
>>  env.put("VAR2", var2Value);
>> }
>>
>> For example, in a SimpleBuildStep I would use the TaskListener
>>
>> @Override
>> public void perform(Run run, FilePath workspace, Launcher launcher, 
>> TaskListener listener) {
>>  listener.getLogger().println("About to do some stuff");
>> }
>>
>> but I cannot find a similar option in for parameters.
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/5178aa8a-cacb-4899-8d5d-0fac0bd1c2f9%40googlegroups.com.


Re: Is it possible to log to console for a parameter plugin?

2019-12-14 Thread Oleg Nenashev
Hi Andrew,

Some APIs have been created before the logging framework, and they might be 
lacking logger references. ParameterValue is unfortunately one of the 
examples of such old APIs, AFAICT there is no clean API to reference the 
listener. 
My recommendation would be to just create a path to the Jenkins core and to 
route parameters correctly.

I believe the listener can be still retrieved using reflection, but I do 
not have example for it

On Saturday, December 14, 2019 at 1:41:17 PM UTC+1, Andrew Sumner wrote:
>
> I am writing a custom parameter using the 
> SimpleParameterDefinition/ParameterValue 
> classes
>
> Is it possible to log to the console in buildEnvironment method?
>
> @Override
> public void buildEnvironment(Run build, EnvVars env) {
>  env.put("VAR1", var1Value);
>  env.put("VAR2", var2Value);
> }
>
> For example, in a SimpleBuildStep I would use the TaskListener
>
> @Override
> public void perform(Run run, FilePath workspace, Launcher launcher, 
> TaskListener listener) {
>  listener.getLogger().println("About to do some stuff");
> }
>
> but I cannot find a similar option in for parameters.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/3b8eff1c-1c33-4ecf-887f-c3ffed3537ba%40googlegroups.com.


Is it possible to log to console for a parameter plugin?

2019-12-14 Thread Andrew Sumner
I am writing a custom parameter using the 
SimpleParameterDefinition/ParameterValue 
classes

Is it possible to log to the console in buildEnvironment method?

@Override
public void buildEnvironment(Run build, EnvVars env) {
 env.put("VAR1", var1Value);
 env.put("VAR2", var2Value);
}

For example, in a SimpleBuildStep I would use the TaskListener

@Override
public void perform(Run run, FilePath workspace, Launcher launcher, 
TaskListener listener) {
 listener.getLogger().println("About to do some stuff");
}

but I cannot find a similar option in for parameters.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/efa05ec6-df83-41b1-ac36-83bbc806db4a%40googlegroups.com.