[jboss-cvs] jboss-seam/src/main/org/jboss/seam ...

Gavin King gavin.king at jboss.com
Wed Feb 7 17:30:25 EST 2007


  User: gavin   
  Date: 07/02/07 17:30:25

  Modified:    src/main/org/jboss/seam  Component.java
  Log:
  multiple loggers JBSEAM-787
  
  Revision  Changes    Path
  1.232     +10 -6     jboss-seam/src/main/org/jboss/seam/Component.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Component.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/Component.java,v
  retrieving revision 1.231
  retrieving revision 1.232
  diff -u -b -r1.231 -r1.232
  --- Component.java	7 Feb 2007 22:23:43 -0000	1.231
  +++ Component.java	7 Feb 2007 22:30:25 -0000	1.232
  @@ -124,7 +124,7 @@
    *
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
    * @author Gavin King
  - * @version $Revision: 1.231 $
  + * @version $Revision: 1.232 $
    */
   @Scope(ScopeType.APPLICATION)
   @SuppressWarnings("deprecation")
  @@ -173,7 +173,7 @@
      private Map<Field, Annotation> dataModelSelectionFieldAnnotations = new HashMap<Field, Annotation>();
   
      private List<Field> logFields = new ArrayList<Field>();
  -   private org.jboss.seam.log.Log logInstance;
  +   private List<org.jboss.seam.log.Log> logInstances = new ArrayList<org.jboss.seam.log.Log>();
   
      private Hashtable<Locale, ClassValidator> validators = new Hashtable<Locale, ClassValidator>();
   
  @@ -578,8 +578,8 @@
               }
               if ( field.isAnnotationPresent(org.jboss.seam.annotations.Logger.class) )
               {
  -               logFields.add(field);
                  String category = field.getAnnotation(org.jboss.seam.annotations.Logger.class).value();
  +               org.jboss.seam.log.Log logInstance;
                  if ( "".equals( category ) )
                  {
                     logInstance = org.jboss.seam.log.Logging.getLog(beanClass);
  @@ -591,7 +591,11 @@
                  if ( Modifier.isStatic( field.getModifiers() ) )
                  {
                     Reflections.setAndWrap(field, null, logInstance);
  -                  logFields = null;
  +               }
  +               else
  +               {
  +                  logFields.add(field);
  +                  logInstances.add(logInstance);
                  }
               }
               for ( Annotation ann: field.getAnnotations() )
  @@ -1167,9 +1171,9 @@
   
      private void injectLog(Object bean)
      {
  -      for (Field logField: logFields)
  +      for (int i=0; i<logFields.size(); i++)
         {
  -         setFieldValue(bean, logField, "log", logInstance);
  +         setFieldValue( bean, logFields.get(i), "log", logInstances.get(i) );
         }
      }
   
  
  
  



More information about the jboss-cvs-commits mailing list