On Mon, Mar 24, 2014 at 5:04 PM, Ralph Goers <[email protected]>wrote:

> OK.  For that kind of usage LogManager.exists(String name) would be fine.
>  The Javadoc needs to make sure to spell this out though.
>

Committed with this Javadoc:

    /**
     * Detects if a Logger with the specified name exists. This is a
convenience method for porting from version 1.
     *
     * @param name
     *            The Logger name to search for.
     * @return true if the Logger exists, false otherwise.
     * @see LoggerContext#hasLogger(String)
     */
    public static boolean exists(String name) {
        return getContext().hasLogger(name);
    }

Gary


> Ralph
>
> On Mar 24, 2014, at 1:41 PM, Gary Gregory <[email protected]> wrote:
>
> On Mon, Mar 24, 2014 at 4:13 PM, Ralph Goers <[email protected]>
> wrote:
>
>> Question.  Is the user trying to determine if a Logger exists or if the
>> configuration for that logger name exists?   IOW - what is the point of
>> querying whether a Logger exists or not - the implication is you are going
>> to do some more testing against it.  If they want to determine the
>> configuration for a logger that can’t be done through the API.
>>
>
> I have my archeologist hat on digging in an older part of our server to
> see why the code calls LogManager.exists(String), and from what I can tell,
> it only uses this information for some debug logging to say 'This Logger
> over there exists (or not), this other one over exists (or not)'. The code
> does not look at the config. It really looks to be a sanity check to make
> sure we have some custom internal logging code that sits on top of Log4j v1
> properly hooked up. If there are Logger named foo and bar and so on, then
> we are OK.
>
> Gary
>
>
>>
>> Ralph
>>
>>
>> On Mar 24, 2014, at 12:53 PM, Gary Gregory <[email protected]>
>> wrote:
>>
>> Hi All:
>>
>> In v1.2 we have:
>>
>> LogManager.exists(String)
>>
>> Which can be implemented as a convenience method in 2.0 as:
>>
>>     /**
>>      * Detects if a Logger with the specified name exists. Convenience
>> method for porting from version 1.
>>      * @param name The Logger name to search for.
>>      * @return true if the Logger exists, false otherwise.
>>      * @see LoggerContext#hasLogger(String)
>>      */
>>     public static boolean exists(String name) {
>>         return getContext().hasLogger(name);
>>     }
>>
>> I am not crazy about continuing the use of the "exists" name when
>> "hasLogger" is clearer IMO.
>>
>> Choices:
>> 1- Add LogManager.exists(String), the easiest for porting.
>> 2- Add LogManager.hasLogger(String), the nicest
>> 3- Use LogManager.getContext().hasLogger(String), the ugliest.
>> 4- Other
>>
>> I am leaning for 2.
>>
>> Thoughts?
>>
>> Gary
>>
>> --
>> E-Mail: [email protected] | [email protected] <[email protected]>
>> Java Persistence with Hibernate, Second 
>> Edition<http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>>
>>
>
>
> --
> E-Mail: [email protected] | [email protected] <[email protected]>
> Java Persistence with Hibernate, Second 
> Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
>
>


-- 
E-Mail: [email protected] | [email protected]
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Reply via email to