Bug 57909 - Add getMessageOutputLevel() method to DefaultLogger.java
Summary: Add getMessageOutputLevel() method to DefaultLogger.java
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: unspecified
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
: 57908 (view as bug list)
Depends on:
Reported: 2015-05-08 18:47 UTC by Daniel Reilly
Modified: 2017-09-19 17:11 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Reilly 2015-05-08 18:47:35 UTC
I am writing a specialized set of ant tasks.  I have debug code embedded in these tasks.  I would like an integrated solution for logging data from the debug code that derives its logging level from the logger.

I have log() statements set up with the level parameter, but it is not as effecient as checking the level myself before calling log().  I would be able to avoid processing all the calls to other methods that gather the data to put into the log record text.

It appears that a simple extension to the DefaultLogger would do the trick.  I would like a getMessageOutput() that returns current logging level:

     * Return the current level of message this logger responds to.
    public int getMessageOutputLevel(int level) {
        return this.msgOutputLevel;
Comment 1 Stefan Bodewig 2015-05-08 19:19:51 UTC
*** Bug 57908 has been marked as a duplicate of this bug. ***
Comment 2 Stefan Bodewig 2015-05-14 05:20:39 UTC
I'm not sure how this would help.  In theory there may be multiple BuildListeners attached - each of them using a different log level.  Also, some of our built in BuildListeners and most probably all IDE integrations don't extend DefaultLogger at all.
Comment 3 Daniel Reilly 2015-05-31 17:38:16 UTC
When someone specified the -d (debug) parameter, where is that information stored?  What I need is a simple way to access that information.
Comment 4 Stefan Bodewig 2015-05-31 17:48:59 UTC
(In reply to Daniel Reilly from comment #3)
> When someone specified the -d (debug) parameter, where is that information
> stored?  What I need is a simple way to access that information.

In Main's msgOutputLevel and passed to any BuildLogger's setMessageOutputLevel.

The former is specific to Ant run via the command line, IDE integrations most likely plug in an AntMain implementation of their own.  BuildLogger is an interface, where information is stored is up to the implementation.
Comment 5 Daniel Reilly 2017-09-19 17:11:56 UTC
So, can we add a getMsgOutputLevel() to Main?