Re: Message output level not public for Project class

2022-11-07 Thread Jaikiran Pai
A new method has been introduced on BuildLogger interface called 
getMessageOutputLevel() which will return the currently set level. This 
will be available in the next Ant release.


-Jaikiran

On 11/10/22 10:38 am, Jaikiran Pai wrote:
With Ant 1.10.x version requiring Java 8, I think it should now be 
possible for us to add a new (default) method to the 
org.apache.tools.ant.BuildLogger interface to return the current set 
(or some default) log level. I will add something along these lines 
shortly.


-Jaikiran

On 11/10/22 10:26 am, Gilles Querret wrote:

Hello Earl,


So far I've used this workaround to retrieve the log level:
https://github.com/Riverside-Software/pct/blob/d8446a002aaf2efb255d2016a16e9a71f7ad269f/src/java/com/phenix/pct/PCT.java#L593 


Usage in the Ant task:
https://github.com/Riverside-Software/pct/blob/master/src/java/com/phenix/pct/PCTRun.java#L475 



Code was written years ago, there might be a better solution now.

Gilles

On Wed, Sep 7, 2022 at 8:24 PM Earl Hood  wrote:


Ant Devs,

Working on a custom task that will exec an external program. One 
thing I
would like to do is if ant is invoked with debugging output level, 
set the

debugging flag to the external program.

Unfortunately, it seems to get the current logging level is not 
easy, as

the level set when Ant is invoked is private with no getter method to
retrieve it.  I see the level is passed into build listeners, but those
APIs also do not expose the level.

Is there any way to retrieve the current logging level, and if not, is
reasonable to make the current level accessible via a public method 
in the

Project class?

Best regards,

--ewh





-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Message output level not public for Project class

2022-10-11 Thread Earl Hood
This is very helpful. Did not even consider using reflection. I adapted
your method into a static utility method that given a Project instance,
will return the logging level for it.

Thanks,

--ewh


On Mon, Oct 10, 2022, 11:56 PM Gilles Querret <
g.quer...@riverside-software.fr> wrote:

>
> So far I've used this workaround to retrieve the log level:
>
> https://github.com/Riverside-Software/pct/blob/d8446a002aaf2efb255d2016a16e9a71f7ad269f/src/java/com/phenix/pct/PCT.java#L593
> Usage in the Ant task:
>
> https://github.com/Riverside-Software/pct/blob/master/src/java/com/phenix/pct/PCTRun.java#L475
>
> Code was written years ago, there might be a better solution now.
>
> Gilles
>


Re: Message output level not public for Project class

2022-10-10 Thread Jaikiran Pai
With Ant 1.10.x version requiring Java 8, I think it should now be 
possible for us to add a new (default) method to the 
org.apache.tools.ant.BuildLogger interface to return the current set (or 
some default) log level. I will add something along these lines shortly.


-Jaikiran

On 11/10/22 10:26 am, Gilles Querret wrote:

Hello Earl,


So far I've used this workaround to retrieve the log level:
https://github.com/Riverside-Software/pct/blob/d8446a002aaf2efb255d2016a16e9a71f7ad269f/src/java/com/phenix/pct/PCT.java#L593
Usage in the Ant task:
https://github.com/Riverside-Software/pct/blob/master/src/java/com/phenix/pct/PCTRun.java#L475

Code was written years ago, there might be a better solution now.

Gilles

On Wed, Sep 7, 2022 at 8:24 PM Earl Hood  wrote:


Ant Devs,

Working on a custom task that will exec an external program. One thing I
would like to do is if ant is invoked with debugging output level, set the
debugging flag to the external program.

Unfortunately, it seems to get the current logging level is not easy, as
the level set when Ant is invoked is private with no getter method to
retrieve it.  I see the level is passed into build listeners, but those
APIs also do not expose the level.

Is there any way to retrieve the current logging level, and if not, is
reasonable to make the current level accessible via a public method in the
Project class?

Best regards,

--ewh





-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org



Re: Message output level not public for Project class

2022-10-10 Thread Gilles Querret
Hello Earl,


So far I've used this workaround to retrieve the log level:
https://github.com/Riverside-Software/pct/blob/d8446a002aaf2efb255d2016a16e9a71f7ad269f/src/java/com/phenix/pct/PCT.java#L593
Usage in the Ant task:
https://github.com/Riverside-Software/pct/blob/master/src/java/com/phenix/pct/PCTRun.java#L475

Code was written years ago, there might be a better solution now.

Gilles

On Wed, Sep 7, 2022 at 8:24 PM Earl Hood  wrote:

> Ant Devs,
>
> Working on a custom task that will exec an external program. One thing I
> would like to do is if ant is invoked with debugging output level, set the
> debugging flag to the external program.
>
> Unfortunately, it seems to get the current logging level is not easy, as
> the level set when Ant is invoked is private with no getter method to
> retrieve it.  I see the level is passed into build listeners, but those
> APIs also do not expose the level.
>
> Is there any way to retrieve the current logging level, and if not, is
> reasonable to make the current level accessible via a public method in the
> Project class?
>
> Best regards,
>
> --ewh
>


-- 
Gilles QUERRET

Riverside Software
91 chemin des églantiers • 69440 Taluyers • France
Mob : +33 662.525.532


Message output level not public for Project class

2022-09-07 Thread Earl Hood
Ant Devs,

Working on a custom task that will exec an external program. One thing I
would like to do is if ant is invoked with debugging output level, set the
debugging flag to the external program.

Unfortunately, it seems to get the current logging level is not easy, as
the level set when Ant is invoked is private with no getter method to
retrieve it.  I see the level is passed into build listeners, but those
APIs also do not expose the level.

Is there any way to retrieve the current logging level, and if not, is
reasonable to make the current level accessible via a public method in the
Project class?

Best regards,

--ewh