logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Glezen" <pgle...@us.ibm.com>
Subject Re: Recent commit by Paul
Date Mon, 04 Jun 2001 17:43:08 GMT
Ceki,

The PropertyConfigurator only sets the default category factory when
someone has specified that a different category factory be used (via the
categoryFactory property).  Without this behaviour, we are saying go ahead
and specify any factory you want, but you can't use it to instantiate
categories in your code.

Perhaps, as you alluded to, we could make this configurable - something
like

   log4j.defaultFactoryOverride=true

would allow a configurator to modify the hierarchy's factory.

- Paul

Paul Glezen
IT Specialist
Software Services
818 539 3321


Ceki Gülcü <cgu@qos.ch> on 06/04/2001 09:56:50 AM

Please respond to "LOG4J Developers Mailing List"
      <log4j-dev@jakarta.apache.org>

To:   "LOG4J Developers Mailing List" <log4j-dev@jakarta.apache.org>
cc:
Subject:  Re: Recent commit by Paul




Hello Paul,

Having the PropertyConfigurator set the default category is an important
and rather invasive change. I am uncomfortable with it especially because
there is no way to override it. I would like to have it commented out until
we find a better solution. Regards, Ceki

At 07:49 04.06.2001 -0700, you wrote:
>This would be troublesome if multiple extensions were in use within the
>same JVM.  I do provide an alternative (referred to as "very manual
>configuration" in the package javadocs) that leaves the hierarchy alone.
>Unfortunately, this does not occur automatically (as implied by the name
>"very manual").
>
>It's certainly something that needs to be worked out because I'm planning
>to use multiple extensions in the near future.  (Namely, ServletCategory
>and EJB Category; which could conceivably be present in the same JVM).
>Presently, PropertyConfigurator only supports configuration of one
category
>factory.  As it is now, I don't see how multiple extensions could step on
>each other without doing so manually.
>
>- Paul
>
>Paul Glezen
>IT Specialist
>Software Services
>818 539 3321
>
>
>Ceki Gülcü <cgu@qos.ch> on 06/04/2001 12:55:24 AM
>
>Please respond to "LOG4J Developers Mailing List"
>      <log4j-dev@jakarta.apache.org>
>
>To:   "LOG4J Developers Mailing List" <log4j-dev@jakarta.apache.org>
>cc:
>Subject:  Recent commit by Paul
>
>
>
>
>Hello Paul,
>
>The recent addition of
>
>   Category.getDefaultHierarchy().setCategoryFactory(categoryFactory);
>
>in configureCategoryFactory method in PropertyConfigurator.java is
>troublesome. Setting the category factory once and fall al may be suitable
>in certain cases but precludes different extensions of Category class to
>live side by side. This will come and bite us again and again.
>
>This is it for now. Ceki
>
>At 06:20 04.06.2001 +0000, you wrote:
>>pglezen     01/06/03 23:20:57
>>
>>  Modified:    src/java/org/apache/log4j PropertyConfigurator.java
>>                        Hierarchy.java
>>  Log:
>>  1. PropertyConfigurator - Added a few lines to
>>        configureCategoryFactory to take advantage of the
>>        PropertySetter class.
>>  2. Hierarchy - Added a setter for the default category
>>        factory so that Category.getInstance uses the
>>        correct factory.  The default category was changed
>>        to non-static.  This allows one to use different
>>        factories for different hierarchies.
>>
>>  Revision  Changes    Path
>>  1.26      +7 -4
>jakarta-log4j/src/java/org/apache/log4j/PropertyConfigurator.java
>>
>>  Index: PropertyConfigurator.java
>>  ===================================================================
>>  RCS file:
>/home/cvs/jakarta-log4j/src/java/org/apache/log4j/PropertyConfigurator.java,v

>
>>  retrieving revision 1.25
>>  retrieving revision 1.26
>>  diff -u -r1.25 -r1.26
>>  --- PropertyConfigurator.java 2001/05/31 16:55:19     1.25
>>  +++ PropertyConfigurator.java 2001/06/04 06:20:56     1.26
>>  @@ -87,11 +87,12 @@
>>     protected Hashtable registry = new Hashtable(11);
>>     protected CategoryFactory categoryFactory = new
>DefaultCategoryFactory();
>>
>>  -  static final String CATEGORY_PREFIX = "log4j.category.";
>>  -  static final String ADDITIVITY_PREFIX = "log4j.additivity.";
>>  +  static final String      CATEGORY_PREFIX = "log4j.category.";
>>  +  static final String       FACTORY_PREFIX = "log4j.factory";
>>  +  static final String    ADDITIVITY_PREFIX = "log4j.additivity.";
>>     static final String ROOT_CATEGORY_PREFIX = "log4j.rootCategory";
>>  -  static final String APPENDER_PREFIX = "log4j.appender.";
>>  -  static final String RENDERER_PREFIX = "log4j.renderer.";
>>  +  static final String      APPENDER_PREFIX = "log4j.appender.";
>>  +  static final String      RENDERER_PREFIX = "log4j.renderer.";
>>
>>     /** Key for specifying the {@link
>org.apache.log4j.spi.CategoryFactory
>>         CategoryFactory}.  Currently set to
>>  @@ -459,6 +460,8 @@
>>
>OptionConverter.instantiateByClassName(factoryClassName,
>>
>CategoryFactory.class,
>>                                                        categoryFactory);
>>  +      PropertySetter.setProperties(categoryFactory, props,
>FACTORY_PREFIX + ".");
>>  +      Category.getDefaultHierarchy
>().setCategoryFactory(categoryFactory);
>>       }
>>     }
>>
>>
>>
>>
>>  1.16      +13 -3
>jakarta-log4j/src/java/org/apache/log4j/Hierarchy.java
>>
>>  Index: Hierarchy.java
>>  ===================================================================
>>  RCS file:
>/home/cvs/jakarta-log4j/src/java/org/apache/log4j/Hierarchy.java,v
>>  retrieving revision 1.15
>>  retrieving revision 1.16
>>  diff -u -r1.15 -r1.16
>>  --- Hierarchy.java    2001/05/20 11:01:13     1.15
>>  +++ Hierarchy.java    2001/06/04 06:20:56     1.16
>>  @@ -61,9 +61,7 @@
>>     static final int DISABLE_OFF = -1;
>>     static final int DISABLE_OVERRIDE = -2;
>>
>>  -  static
>>  -  private
>>  -  CategoryFactory defaultFactory = new DefaultCategoryFactory();
>>  +  private CategoryFactory defaultFactory;
>>
>>
>>     Hashtable ht;
>>  @@ -89,6 +87,7 @@
>>       disable = DISABLE_OFF;
>>       this.root.setHierarchy(this);
>>       rendererMap = new RendererMap();
>>  +     defaultFactory = new DefaultCategoryFactory();
>>     }
>>
>>     /**
>>  @@ -404,6 +403,17 @@
>>         }
>>       }
>>       rendererMap.clear();
>>  +  }
>>  +
>>  +  /**
>>  +     Set the default CategoryFactory instance.
>>  +
>>  +     @since 1.1
>>  +   */
>>  +  public void setCategoryFactory(CategoryFactory factory)
>>  +  {
>>  +    if (factory != null)
>>  +      defaultFactory = factory;
>>     }
>>
>>     /**
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: log4j-cvs-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: log4j-cvs-help@jakarta.apache.org
>
>--
>Ceki Gülcü
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-dev-help@jakarta.apache.org
>
>
>r
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-dev-help@jakarta.apache.org

--
Ceki Gülcü


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org


Mime
View raw message