You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by T Master <tm...@iknowledgeinc.com> on 2001/10/18 00:43:10 UTC
Null Priority obtained from Category. Bug?
Problem: Obtain an instance of a Category (defined in file with level) with
a null Priority.
My config file (properties) contains:
log4j.category.USER.Category1=INFO
I obtained this by using :
Code:
Category c = userHierarchy.getInstance("USER.Category1");
System.out.println("category1 obtained was...."+c.getName());
System.out.println("category1 priority is...."+c.getPriority());
Category cat = Category.getInstance("tester");
System.out.println("category2 obtained was...."+cat.getName());
System.out.println("category2 priority
is...."+cat.getPriority());
Output:
category1 obtained was....USER.Category1
category1 priority is....null.
category2 obtained was....tester
category2 priority is....null.
However, I have tried using a Category name of:
"log4j.category.USER.Category1", with same result.
Read the following:
public static Category getInstance(String name)
Retrieve a category with named as the name parameter. If the named
category already exists, then the existing instance will be reutrned.
Otherwise, a new instance is created. By default, categories do not have a
set priority but inherit it from the hierarchy. This is one of the central
features of log4j.
Parameters:
name - The name of the category to retrieve
I am creating my Hierarchy object like so:
userHierarchy = new Hierarchy( Category.getInstance("USER") );
If a Hierarchy is created with a Category that has no defined
Priority/Level, then what is the default?
Regards,
T Master
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: Null Priority obtained from Category. Bug?
Posted by T Master <tm...@iknowledgeinc.com>.
Counting...
Three seconds to load Category.java and see:
final Hierarchy defaultHierarchy = new Hierarchy(new
RootCategory(Priority.DEBUG));
A RootCategory is guarenteed a *not* null Priority.
So.... my thinking and understanding it to use this for my own Hierarchy.
"The root category names itself as "root". ". Then work on creating a
Category called "USER" elsewhere.
----- Original Message -----
From: "Ceki Gülcü" <cg...@qos.ch>
To: "LOG4J Users Mailing List" <lo...@jakarta.apache.org>
Sent: Thursday, October 18, 2001 5:32 PM
Subject: Re: Null Priority obtained from Category. Bug?
> At 16:25 18.10.2001 -0600, you wrote:
> >Noone has responded to my previous email..
> >
> >Is this a bug? My workaround is to set a default INFO priority always.
>
> Do you think it's a bug? Come on, you are being lazy here,
> just read the source of the Category class. It will take you
> 20 seconds to realize your mistake.
>
> >>
> >> I am creating my Hierarchy object like so:
> >> userHierarchy = new Hierarchy( Category.getInstance("USER") );
> >>
> >> If a Hierarchy is created with a Category that has no defined
> >> Priority/Level, then what is the default?
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: Null Priority obtained from Category. Bug?
Posted by Ceki Gülcü <cg...@qos.ch>.
At 16:25 18.10.2001 -0600, you wrote:
>Noone has responded to my previous email..
>
>Is this a bug? My workaround is to set a default INFO priority always.
Do you think it's a bug? Come on, you are being lazy here,
just read the source of the Category class. It will take you
20 seconds to realize your mistake.
>----- Original Message -----
>From: "T Master" <tm...@iknowledgeinc.com>
>To: <lo...@jakarta.apache.org>
>Sent: Wednesday, October 17, 2001 4:43 PM
>Subject: Null Priority obtained from Category. Bug?
>
>
>> Problem: Obtain an instance of a Category (defined in file with level)
>with
>> a null Priority.
>>
>>
>> My config file (properties) contains:
>> log4j.category.USER.Category1=INFO
>>
>> I obtained this by using :
>> Code:
>> Category c = userHierarchy.getInstance("USER.Category1");
>> System.out.println("category1 obtained was...."+c.getName());
>> System.out.println("category1 priority
>is...."+c.getPriority());
>>
>> Category cat = Category.getInstance("tester");
>> System.out.println("category2 obtained
>was...."+cat.getName());
>> System.out.println("category2 priority
>> is...."+cat.getPriority());
>>
>> Output:
>>
>> category1 obtained was....USER.Category1
>> category1 priority is....null.
>> category2 obtained was....tester
>> category2 priority is....null.
>>
>> However, I have tried using a Category name of:
>> "log4j.category.USER.Category1", with same result.
>>
>>
>> Read the following:
>> public static Category getInstance(String name)
>> Retrieve a category with named as the name parameter. If the named
>> category already exists, then the existing instance will be reutrned.
>> Otherwise, a new instance is created. By default, categories do not have a
>> set priority but inherit it from the hierarchy. This is one of the central
>> features of log4j.
>> Parameters:
>> name - The name of the category to retrieve
>>
>>
>> I am creating my Hierarchy object like so:
>> userHierarchy = new Hierarchy( Category.getInstance("USER") );
>>
>> If a Hierarchy is created with a Category that has no defined
>> Priority/Level, then what is the default?
>>
>>
>> Regards,
>>
>> T Master
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
--
Ceki Gülcü - http://qos.ch
Link of the day: http://www.washingtonpost.com/wp-dyn/articles/A63884-2001Oct15.html
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: Null Priority obtained from Category. Bug?
Posted by T Master <tm...@iknowledgeinc.com>.
Noone has responded to my previous email..
Is this a bug? My workaround is to set a default INFO priority always.
----- Original Message -----
From: "T Master" <tm...@iknowledgeinc.com>
To: <lo...@jakarta.apache.org>
Sent: Wednesday, October 17, 2001 4:43 PM
Subject: Null Priority obtained from Category. Bug?
> Problem: Obtain an instance of a Category (defined in file with level)
with
> a null Priority.
>
>
> My config file (properties) contains:
> log4j.category.USER.Category1=INFO
>
> I obtained this by using :
> Code:
> Category c = userHierarchy.getInstance("USER.Category1");
> System.out.println("category1 obtained was...."+c.getName());
> System.out.println("category1 priority
is...."+c.getPriority());
>
> Category cat = Category.getInstance("tester");
> System.out.println("category2 obtained
was...."+cat.getName());
> System.out.println("category2 priority
> is...."+cat.getPriority());
>
> Output:
>
> category1 obtained was....USER.Category1
> category1 priority is....null.
> category2 obtained was....tester
> category2 priority is....null.
>
> However, I have tried using a Category name of:
> "log4j.category.USER.Category1", with same result.
>
>
> Read the following:
> public static Category getInstance(String name)
> Retrieve a category with named as the name parameter. If the named
> category already exists, then the existing instance will be reutrned.
> Otherwise, a new instance is created. By default, categories do not have a
> set priority but inherit it from the hierarchy. This is one of the central
> features of log4j.
> Parameters:
> name - The name of the category to retrieve
>
>
> I am creating my Hierarchy object like so:
> userHierarchy = new Hierarchy( Category.getInstance("USER") );
>
> If a Hierarchy is created with a Category that has no defined
> Priority/Level, then what is the default?
>
>
> Regards,
>
> T Master
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org