[seam-dev] Re: [seam-commits] Seam SVN: r10542 - in modules/trunk: logging and 15 other directories.

Shane Bryzak shane.bryzak at jboss.com
Tue Apr 21 06:10:20 EDT 2009


Fair enough, I've backed it out now.

Pete Muir wrote:
> The Web Beans version is implementation independent (check out the 
> Extensions chapter :-)
>
> On 21 Apr 2009, at 11:00, Shane Bryzak wrote:
>
>> Do we want a dependency on webbeans though? I thought this stuff was 
>> supposed to be implementation-independent.
>>
>> Pete Muir wrote:
>>> Shane,
>>>
>>> We've already developed the logging module for webbeans - see 
>>> org.jboss.webbeans:webbeans-logger and 
>>> org.jboss.webbeans:webbeans-logging
>>>
>>> On 21 Apr 2009, at 10:38, seam-commits at lists.jboss.org wrote:
>>>
>>>> Author: shane.bryzak at jboss.com
>>>> Date: 2009-04-21 05:38:36 -0400 (Tue, 21 Apr 2009)
>>>> New Revision: 10542
>>>>
>>>> Added:
>>>>  modules/trunk/logging/
>>>>  modules/trunk/logging/pom.xml
>>>>  modules/trunk/logging/src/
>>>>  modules/trunk/logging/src/main/
>>>>  modules/trunk/logging/src/main/java/
>>>>  modules/trunk/logging/src/main/java/org/
>>>>  modules/trunk/logging/src/main/java/org/jboss/
>>>>  modules/trunk/logging/src/main/java/org/jboss/seam/
>>>>  modules/trunk/logging/src/main/java/org/jboss/seam/log/
>>>>  modules/trunk/logging/src/main/java/org/jboss/seam/log/JDKProvider.java 
>>>>
>>>>  modules/trunk/logging/src/main/java/org/jboss/seam/log/Log.java
>>>>  modules/trunk/logging/src/main/java/org/jboss/seam/log/Log4JProvider.java 
>>>>
>>>>  modules/trunk/logging/src/main/java/org/jboss/seam/log/LogImpl.java
>>>>  modules/trunk/logging/src/main/java/org/jboss/seam/log/LogProvider.java 
>>>>
>>>>  modules/trunk/logging/src/main/java/org/jboss/seam/log/Logging.java
>>>>  modules/trunk/logging/target/
>>>>  modules/trunk/logging/target/classes/
>>>>  modules/trunk/logging/target/classes/org/
>>>>  modules/trunk/logging/target/classes/org/jboss/
>>>>  modules/trunk/logging/target/classes/org/jboss/seam/
>>>>  modules/trunk/logging/target/classes/org/jboss/seam/log/
>>>>  modules/trunk/parent/
>>>>  modules/trunk/parent/pom.xml
>>>> Modified:
>>>>  modules/trunk/security/pom.xml
>>>>  modules/trunk/version-matrix/pom.xml
>>>> Log:
>>>> added logging module, parent pom, updated version-matrix pom
>>>>
>>>> Added: modules/trunk/logging/pom.xml
>>>> ===================================================================
>>>> --- modules/trunk/logging/pom.xml                            (rev 0)
>>>> +++ modules/trunk/logging/pom.xml    2009-04-21 09:38:36 UTC (rev 
>>>> 10542)
>>>> @@ -0,0 +1,22 @@
>>>> +<project xmlns="http://maven.apache.org/POM/4.0.0" 
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>>>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
>>>> http://maven.apache.org/maven-v4_0_0.xsd">
>>>> +   <parent>
>>>> +      <artifactId>seam-parent</artifactId>
>>>> +      <groupId>org.jboss.seam</groupId>
>>>> +      <version>3.0.0-SNAPSHOT</version>
>>>> +   </parent>
>>>> +
>>>> +   <modelVersion>4.0.0</modelVersion>
>>>> +   <groupId>org.jboss.seam</groupId>
>>>> +   <artifactId>seam-logging</artifactId>
>>>> +   <version>3.0.0-SNAPSHOT</version>
>>>> +   <name>Seam Logging</name>
>>>> +   <dependencies>
>>>> +
>>>> +      <dependency>
>>>> +         <groupId>log4j</groupId>
>>>> +         <artifactId>log4j</artifactId>
>>>> +         <optional>true</optional>
>>>> +      </dependency>
>>>> +
>>>> +   </dependencies>
>>>> +</project>
>>>>
>>>> Added: 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/JDKProvider.java 
>>>>
>>>> ===================================================================
>>>> --- 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/JDKProvider.java                            
>>>> (rev 0)
>>>> +++ 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/JDKProvider.java    
>>>> 2009-04-21 09:38:36 UTC (rev 10542)
>>>> @@ -0,0 +1,140 @@
>>>> +package org.jboss.seam.log;
>>>> +
>>>> +import java.util.logging.Level;
>>>> +import java.util.logging.Logger;
>>>> +
>>>> +/**
>>>> + *
>>>> + * @author Gavin King
>>>> + *
>>>> + */
>>>> +class JDKProvider implements LogProvider
>>>> +{
>>>> +   private final Logger logger;
>>>> +   private final boolean isWrapped;
>>>> +
>>>> +   JDKProvider(String category, boolean wrapped)
>>>> +   {
>>>> +      this.logger = Logger.getLogger(category);
>>>> +      this.isWrapped = wrapped;
>>>> +   }
>>>> +
>>>> +   private void log(Level level, Object object, Throwable ex)
>>>> +   {
>>>> +
>>>> +      if (logger.isLoggable(level))
>>>> +      {
>>>> +         Throwable dummyException = new Throwable();
>>>> +         StackTraceElement locations[] = 
>>>> dummyException.getStackTrace();
>>>> +         String className = "unknown";
>>>> +         String methodName = "unknown";
>>>> +         int depth = isWrapped ? 3 : 2;
>>>> +         if (locations != null && locations.length > depth)
>>>> +         {
>>>> +            StackTraceElement caller = locations[depth];
>>>> +            className = caller.getClassName();
>>>> +            methodName = caller.getMethodName();
>>>> +         }
>>>> +         if (ex == null)
>>>> +         {
>>>> +            logger.logp(level, className, methodName, 
>>>> String.valueOf(object));
>>>> +         }
>>>> +         else
>>>> +         {
>>>> +            logger.logp(level, className, methodName, 
>>>> String.valueOf(object), ex);
>>>> +         }
>>>> +      }
>>>> +
>>>> +   }
>>>> +
>>>> +   public void debug(Object object, Throwable t)
>>>> +   {
>>>> +      log(Level.FINE, object, t);
>>>> +   }
>>>> +
>>>> +   public void debug(Object object)
>>>> +   {
>>>> +      log(Level.FINE, object, null);
>>>> +   }
>>>> +
>>>> +   public void error(Object object, Throwable t)
>>>> +   {
>>>> +      log(Level.SEVERE, object, t);
>>>> +   }
>>>> +
>>>> +   public void error(Object object)
>>>> +   {
>>>> +      log(Level.SEVERE, object, null);
>>>> +   }
>>>> +
>>>> +   public void fatal(Object object, Throwable t)
>>>> +   {
>>>> +      log(Level.SEVERE, object, t);
>>>> +   }
>>>> +
>>>> +   public void fatal(Object object)
>>>> +   {
>>>> +      log(Level.SEVERE, object, null);
>>>> +   }
>>>> +
>>>> +   public void info(Object object, Throwable t)
>>>> +   {
>>>> +      log(Level.INFO, object, t);
>>>> +   }
>>>> +
>>>> +   public void info(Object object)
>>>> +   {
>>>> +      log(Level.INFO, object, null);
>>>> +   }
>>>> +
>>>> +   public boolean isDebugEnabled()
>>>> +   {
>>>> +      return logger.isLoggable(Level.FINE);
>>>> +   }
>>>> +
>>>> +   public boolean isErrorEnabled()
>>>> +   {
>>>> +      return logger.isLoggable(Level.SEVERE);
>>>> +   }
>>>> +
>>>> +   public boolean isFatalEnabled()
>>>> +   {
>>>> +      return logger.isLoggable(Level.SEVERE);
>>>> +   }
>>>> +
>>>> +   public boolean isInfoEnabled()
>>>> +   {
>>>> +      return logger.isLoggable(Level.INFO);
>>>> +   }
>>>> +
>>>> +   public boolean isTraceEnabled()
>>>> +   {
>>>> +      return logger.isLoggable(Level.FINER);
>>>> +   }
>>>> +
>>>> +   public boolean isWarnEnabled()
>>>> +   {
>>>> +      return logger.isLoggable(Level.WARNING);
>>>> +   }
>>>> +
>>>> +   public void trace(Object object, Throwable t)
>>>> +   {
>>>> +      log(Level.FINER, object, t);
>>>> +   }
>>>> +
>>>> +   public void trace(Object object)
>>>> +   {
>>>> +      log(Level.FINER, object, null);
>>>> +   }
>>>> +
>>>> +   public void warn(Object object, Throwable t)
>>>> +   {
>>>> +      log(Level.WARNING, object, t);
>>>> +   }
>>>> +
>>>> +   public void warn(Object object)
>>>> +   {
>>>> +      log(Level.WARNING, object, null);
>>>> +   }
>>>> +
>>>> +}
>>>>
>>>> Added: modules/trunk/logging/src/main/java/org/jboss/seam/log/Log.java
>>>> ===================================================================
>>>> --- 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/Log.java                            
>>>> (rev 0)
>>>> +++ 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/Log.java    
>>>> 2009-04-21 09:38:36 UTC (rev 10542)
>>>> @@ -0,0 +1,86 @@
>>>> +package org.jboss.seam.log;
>>>> +
>>>> +/**
>>>> + * <p>A <code>Log</code> object is used to log messages.
>>>> + * They will be logged in any environment that has setup a logging 
>>>> service
>>>> + * such as Log4J or the standard JDK logging facilities.  In fact, 
>>>> this
>>>> + * logging interface is very similar to the other facilities with the
>>>> + * difference that logging methods also take any number of optional
>>>> + * parameters beyond the message object for later interpolation
>>>> + * into the message.</p>
>>>> + *
>>>> + * <p>The idea of using interpolation parameters is very important 
>>>> for
>>>> + * performance reasons in production code.  Normally developers write
>>>> + * logging messages similar to this one:
>>>> + * <pre>
>>>> + *    log.debug("Started processing of " + obj1 + " with action " 
>>>> + obj2);
>>>> + * </pre>
>>>> + * The problem that arises at runtime in production systems, is 
>>>> that DEBUG
>>>> + * level logging may not be enabled.  And even if this logging is 
>>>> going to
>>>> + * be a no-op call, Java must still build the string dynamically 
>>>> that is the
>>>> + * argument to the call.  It is the building of this string that 
>>>> can be quite
>>>> + * time consuming.  The more complex the objects being 
>>>> concatenated are, the
>>>> + * worse the time penalty incurred is.  And this time is 
>>>> completely wasted
>>>> + * since the string may never be used.</p>
>>>> + *
>>>> + * <p>Normally to combat the problem of making this call and 
>>>> building the
>>>> + * string dynamically, the developer uses a conditional statement 
>>>> to invoke
>>>> + * the call only if the corresponding logging level is enabled.  
>>>> So the above
>>>> + * call may end up looking like:
>>>> + * <pre>
>>>> + *    if (log.isDebugEnabled())
>>>> + *    {
>>>> + *       log.debug("Started processing of " + obj1 + " with action 
>>>> " + obj2);
>>>> + *    }
>>>> + * </pre>
>>>> + * Ideally, this structure should always be used to avoid the cost 
>>>> of building the
>>>> + * dynamic string (concatenation) and making the unnecessary 
>>>> call.  The only
>>>> + * drawback to this is that code can become less readable.  In 
>>>> some cases, there
>>>> + * might be more code devoted to logging than the actual behavior 
>>>> required by a
>>>> + * method.</p>
>>>> + *
>>>> + * <p>A cleaner way to do the logging is to use this interface 
>>>> where simple
>>>> + * objects without any concatenation are passed as arguments.  
>>>> Albeit the call
>>>> + * itself may still be a no-op when the logging level is not 
>>>> enabled, this is
>>>> + * still much smaller than the concatenation process with dynamic 
>>>> strings.  Each
>>>> + * of the methods defined here will first check to see if the 
>>>> logging level is enabled,
>>>> + * if that feature exists in the underlying logging system.  If 
>>>> and only if that logging
>>>> + * level is enabled, will the implementation proceed with 
>>>> concatenation of the strings
>>>> + * and objects passed.  So the above code using this interface 
>>>> becomes:
>>>> + * <pre>
>>>> + *    log.debug("Started processing of {0} with action {1}, obj1, 
>>>> obj2);
>>>> + * </pre>
>>>> + * </p>
>>>> + *
>>>> + * <p>The interpolation of parameters into the message string are 
>>>> done using
>>>> + * {@link java.text.MessageFormat}.  See the documentation on that 
>>>> class for
>>>> + * more ideas of interpolation possibilities.  In the above code, 
>>>> <code>obj1</code>
>>>> + * and <code>obj2</code> simply have their <code>toString()</code> 
>>>> methods invoked
>>>> + * to produce a string which is then concatenated.</p>
>>>> + *
>>>> + * @author Gavin King
>>>> + * @author David Allen
>>>> + *
>>>> + */
>>>> +public interface Log
>>>> +{
>>>> +   public boolean isDebugEnabled();
>>>> +   public boolean isErrorEnabled();
>>>> +   public boolean isFatalEnabled();
>>>> +   public boolean isInfoEnabled();
>>>> +   public boolean isTraceEnabled();
>>>> +   public boolean isWarnEnabled();
>>>> +   public void trace(Object object, Object... params);
>>>> +   public void trace(Object object, Throwable t, Object... params);
>>>> +   public void debug(Object object, Object... params);
>>>> +   public void debug(Object object, Throwable t, Object... params);
>>>> +   public void info(Object object, Object... params);
>>>> +   public void info(Object object, Throwable t, Object... params);
>>>> +   public void warn(Object object, Object... params);
>>>> +   public void warn(Object object, Throwable t, Object... params);
>>>> +   public void error(Object object, Object... params);
>>>> +   public void error(Object object, Throwable t, Object... params);
>>>> +   public void fatal(Object object, Object... params);
>>>> +   public void fatal(Object object, Throwable t, Object... params);
>>>> +
>>>> +}
>>>> \ No newline at end of file
>>>>
>>>> Added: 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/Log4JProvider.java 
>>>>
>>>> ===================================================================
>>>> --- 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/Log4JProvider.java                            
>>>> (rev 0)
>>>> +++ 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/Log4JProvider.java    
>>>> 2009-04-21 09:38:36 UTC (rev 10542)
>>>> @@ -0,0 +1,135 @@
>>>> +package org.jboss.seam.log;
>>>> +
>>>> +import org.apache.log4j.Level;
>>>> +import org.apache.log4j.Logger;
>>>> +
>>>> +/**
>>>> + *
>>>> + * @author Gavin King
>>>> + *
>>>> + */
>>>> +final class Log4JProvider implements LogProvider
>>>> +{
>>>> +   private final Logger logger;
>>>> +   private final boolean isWrapped;
>>>> +
>>>> +   private static final String LOG_IMPL_FQCN = 
>>>> LogImpl.class.getName();
>>>> +   private static final String LOG_PROVIDER_FQCN = 
>>>> Log4JProvider.class.getName();
>>>> +
>>>> +   private static final Level TRACE;
>>>> +   static
>>>> +   {
>>>> +      Object trace;
>>>> +      try
>>>> +      {
>>>> +         trace = Level.class.getDeclaredField("TRACE").get(null);
>>>> +      }
>>>> +      catch (Exception e)
>>>> +      {
>>>> +         trace = Level.DEBUG;
>>>> +      }
>>>> +      TRACE = (Level) trace;
>>>> +   }
>>>> +
>>>> +   Log4JProvider(String category, boolean wrapped)
>>>> +   {
>>>> +      logger = Logger.getLogger(category);
>>>> +      isWrapped = wrapped;
>>>> +   }
>>>> +
>>>> +   private String getFQCN()
>>>> +   {
>>>> +      return isWrapped ? LOG_IMPL_FQCN : LOG_PROVIDER_FQCN;
>>>> +   }
>>>> +
>>>> +   public void debug(Object object)
>>>> +   {
>>>> +      logger.log(getFQCN(), Level.DEBUG, object, null);
>>>> +   }
>>>> +
>>>> +   public void debug(Object object, Throwable t)
>>>> +   {
>>>> +      logger.log(getFQCN(), Level.DEBUG, object, t);
>>>> +   }
>>>> +
>>>> +   public void error(Object object)
>>>> +   {
>>>> +      logger.log(getFQCN(), Level.ERROR, object, null);
>>>> +   }
>>>> +
>>>> +   public void error(Object object, Throwable t)
>>>> +   {
>>>> +      logger.log(getFQCN(), Level.ERROR, object, t);
>>>> +   }
>>>> +
>>>> +   public void fatal(Object object)
>>>> +   {
>>>> +      logger.log(getFQCN(), Level.FATAL, object, null);
>>>> +   }
>>>> +
>>>> +   public void fatal(Object object, Throwable t)
>>>> +   {
>>>> +      logger.log(getFQCN(), Level.FATAL, object, t);
>>>> +   }
>>>> +
>>>> +   public void info(Object object)
>>>> +   {
>>>> +      logger.log(getFQCN(), Level.INFO, object, null);
>>>> +   }
>>>> +
>>>> +   public void info(Object object, Throwable t)
>>>> +   {
>>>> +      logger.log(getFQCN(), Level.INFO, object, t);
>>>> +   }
>>>> +
>>>> +   public boolean isDebugEnabled()
>>>> +   {
>>>> +      return logger.isEnabledFor(Level.DEBUG);
>>>> +   }
>>>> +
>>>> +   public boolean isErrorEnabled()
>>>> +   {
>>>> +      return logger.isEnabledFor(Level.ERROR);
>>>> +   }
>>>> +
>>>> +   public boolean isFatalEnabled()
>>>> +   {
>>>> +      return logger.isEnabledFor(Level.FATAL);
>>>> +   }
>>>> +
>>>> +   public boolean isInfoEnabled()
>>>> +   {
>>>> +      return logger.isEnabledFor(Level.INFO);
>>>> +   }
>>>> +
>>>> +   public boolean isTraceEnabled()
>>>> +   {
>>>> +      return logger.isEnabledFor(TRACE);
>>>> +   }
>>>> +
>>>> +   public boolean isWarnEnabled()
>>>> +   {
>>>> +      return logger.isEnabledFor(Level.WARN);
>>>> +   }
>>>> +
>>>> +   public void trace(Object object)
>>>> +   {
>>>> +      logger.log(getFQCN(), TRACE, object, null);
>>>> +   }
>>>> +
>>>> +   public void trace(Object object, Throwable t)
>>>> +   {
>>>> +      logger.log(getFQCN(), TRACE, object, t);
>>>> +   }
>>>> +
>>>> +   public void warn(Object object)
>>>> +   {
>>>> +      logger.log(getFQCN(), Level.WARN, object, null);
>>>> +   }
>>>> +
>>>> +   public void warn(Object object, Throwable t)
>>>> +   {
>>>> +      logger.log(getFQCN(), Level.WARN, object, t);
>>>> +   }
>>>> +
>>>> +}
>>>>
>>>> Added: 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/LogImpl.java
>>>> ===================================================================
>>>> --- 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/LogImpl.java                            
>>>> (rev 0)
>>>> +++ 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/LogImpl.java    
>>>> 2009-04-21 09:38:36 UTC (rev 10542)
>>>> @@ -0,0 +1,184 @@
>>>> +package org.jboss.seam.log;
>>>> +
>>>> +import java.io.Externalizable;
>>>> +import java.io.IOException;
>>>> +import java.io.ObjectInput;
>>>> +import java.io.ObjectOutput;
>>>> +import java.text.MessageFormat;
>>>> +import java.util.Arrays;
>>>> +
>>>> +/**
>>>> + *
>>>> + * @author Gavin King
>>>> + *
>>>> + */
>>>> +class LogImpl implements Log, Externalizable
>>>> +{
>>>> +   private transient LogProvider log;
>>>> +   private String category;
>>>> +
>>>> +   public LogImpl()
>>>> +   {
>>>> +   }
>>>> +
>>>> +   LogImpl(String category)
>>>> +   {
>>>> +      this.category = category;
>>>> +      this.log = Logging.getLogProvider(category, true);
>>>> +   }
>>>> +
>>>> +   public boolean isDebugEnabled()
>>>> +   {
>>>> +      return log.isDebugEnabled();
>>>> +   }
>>>> +
>>>> +   public boolean isErrorEnabled()
>>>> +   {
>>>> +      return log.isErrorEnabled();
>>>> +   }
>>>> +
>>>> +   public boolean isFatalEnabled()
>>>> +   {
>>>> +      return log.isFatalEnabled();
>>>> +   }
>>>> +
>>>> +   public boolean isInfoEnabled()
>>>> +   {
>>>> +      return log.isInfoEnabled();
>>>> +   }
>>>> +
>>>> +   public boolean isTraceEnabled()
>>>> +   {
>>>> +      return log.isTraceEnabled();
>>>> +   }
>>>> +
>>>> +   public boolean isWarnEnabled()
>>>> +   {
>>>> +      return log.isWarnEnabled();
>>>> +   }
>>>> +
>>>> +   public void trace(Object object, Object... params)
>>>> +   {
>>>> +      if (isTraceEnabled())
>>>> +      {
>>>> +         log.trace(interpolate(object, params));
>>>> +      }
>>>> +   }
>>>> +
>>>> +   public void trace(Object object, Throwable t, Object... params)
>>>> +   {
>>>> +      if (isTraceEnabled())
>>>> +      {
>>>> +         log.trace(interpolate(object, params), t);
>>>> +      }
>>>> +   }
>>>> +
>>>> +   public void debug(Object object, Object... params)
>>>> +   {
>>>> +      if (isDebugEnabled())
>>>> +      {
>>>> +         log.debug(interpolate(object, params));
>>>> +      }
>>>> +   }
>>>> +
>>>> +   public void debug(Object object, Throwable t, Object... params)
>>>> +   {
>>>> +      if (isDebugEnabled())
>>>> +      {
>>>> +         log.debug(interpolate(object, params), t);
>>>> +      }
>>>> +   }
>>>> +
>>>> +   public void info(Object object, Object... params)
>>>> +   {
>>>> +      if (isInfoEnabled())
>>>> +      {
>>>> +         log.info(interpolate(object, params));
>>>> +      }
>>>> +   }
>>>> +
>>>> +   public void info(Object object, Throwable t, Object... params)
>>>> +   {
>>>> +      if (isInfoEnabled())
>>>> +      {
>>>> +         log.info(interpolate(object, params), t);
>>>> +      }
>>>> +   }
>>>> +
>>>> +   public void warn(Object object, Object... params)
>>>> +   {
>>>> +      if (isWarnEnabled())
>>>> +      {
>>>> +         log.warn(interpolate(object, params));
>>>> +      }
>>>> +   }
>>>> +
>>>> +   public void warn(Object object, Throwable t, Object... params)
>>>> +   {
>>>> +      if (isWarnEnabled())
>>>> +      {
>>>> +         log.warn(interpolate(object, params), t);
>>>> +      }
>>>> +   }
>>>> +
>>>> +   public void error(Object object, Object... params)
>>>> +   {
>>>> +      if (isErrorEnabled())
>>>> +      {
>>>> +         log.error(interpolate(object, params));
>>>> +      }
>>>> +   }
>>>> +
>>>> +   public void error(Object object, Throwable t, Object... params)
>>>> +   {
>>>> +      if (isErrorEnabled())
>>>> +      {
>>>> +         log.error(interpolate(object, params), t);
>>>> +      }
>>>> +   }
>>>> +
>>>> +   public void fatal(Object object, Object... params)
>>>> +   {
>>>> +      if (isFatalEnabled())
>>>> +      {
>>>> +         log.fatal(interpolate(object, params));
>>>> +      }
>>>> +   }
>>>> +
>>>> +   public void fatal(Object object, Throwable t, Object... params)
>>>> +   {
>>>> +      if (isFatalEnabled())
>>>> +      {
>>>> +         log.fatal(interpolate(object, params), t);
>>>> +      }
>>>> +   }
>>>> +
>>>> +   private Object interpolate(Object message, Object... params)
>>>> +   {
>>>> +      Object interpolatedMessage = message;
>>>> +      if (params.length > 0)
>>>> +      {
>>>> +         for (int i = 0; i < params.length; i++)
>>>> +         {
>>>> +            if (params[i].getClass().isArray())
>>>> +            {
>>>> +               params[i] = Arrays.asList((Object[]) params[i]);
>>>> +            }
>>>> +         }
>>>> +         interpolatedMessage = 
>>>> MessageFormat.format(message.toString(), params);
>>>> +      }
>>>> +      return interpolatedMessage;
>>>> +   }
>>>> +
>>>> +   public void readExternal(ObjectInput in) throws IOException, 
>>>> ClassNotFoundException
>>>> +   {
>>>> +      category = (String) in.readObject();
>>>> +      log = Logging.getLogProvider(category, true);
>>>> +   }
>>>> +
>>>> +   public void writeExternal(ObjectOutput out) throws IOException
>>>> +   {
>>>> +      out.writeObject(category);
>>>> +   }
>>>> +
>>>> +}
>>>>
>>>> Added: 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/LogProvider.java 
>>>>
>>>> ===================================================================
>>>> --- 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/LogProvider.java                            
>>>> (rev 0)
>>>> +++ 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/LogProvider.java    
>>>> 2009-04-21 09:38:36 UTC (rev 10542)
>>>> @@ -0,0 +1,28 @@
>>>> +package org.jboss.seam.log;
>>>> +
>>>> +/**
>>>> + *
>>>> + * @author Gavin King
>>>> + *
>>>> + */
>>>> +public interface LogProvider
>>>> +{
>>>> +   public void trace(Object object);
>>>> +   public void trace(Object object, Throwable t);
>>>> +   public void debug(Object object);
>>>> +   public void debug(Object object, Throwable t);
>>>> +   public void info(Object object);
>>>> +   public void info(Object object, Throwable t);
>>>> +   public void warn(Object object);
>>>> +   public void warn(Object object, Throwable t);
>>>> +   public void error(Object object);
>>>> +   public void error(Object object, Throwable t);
>>>> +   public void fatal(Object object);
>>>> +   public void fatal(Object object, Throwable t);
>>>> +   public boolean isTraceEnabled();
>>>> +   public boolean isDebugEnabled();
>>>> +   public boolean isInfoEnabled();
>>>> +   public boolean isWarnEnabled();
>>>> +   public boolean isErrorEnabled();
>>>> +   public boolean isFatalEnabled();
>>>> +}
>>>>
>>>> Added: 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/Logging.java
>>>> ===================================================================
>>>> --- 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/Logging.java                            
>>>> (rev 0)
>>>> +++ 
>>>> modules/trunk/logging/src/main/java/org/jboss/seam/log/Logging.java    
>>>> 2009-04-21 09:38:36 UTC (rev 10542)
>>>> @@ -0,0 +1,47 @@
>>>> +package org.jboss.seam.log;
>>>> +
>>>> +/**
>>>> + *
>>>> + * @author Gavin King
>>>> + *
>>>> + */
>>>> +public class Logging
>>>> +{
>>>> +   private static final boolean isLog4JAvailable;
>>>> +
>>>> +   static
>>>> +   {
>>>> +      boolean available;
>>>> +      try
>>>> +      {
>>>> +         Class.forName("org.apache.log4j.Logger");
>>>> +         available = true;
>>>> +      }
>>>> +      catch (ClassNotFoundException cnfe)
>>>> +      {
>>>> +         available = false;
>>>> +      }
>>>> +      isLog4JAvailable = available;
>>>> +   }
>>>> +
>>>> +   public static Log getLog(String category)
>>>> +   {
>>>> +      return new LogImpl(category);
>>>> +   }
>>>> +
>>>> +   public static Log getLog(Class<?> clazz)
>>>> +   {
>>>> +      return new LogImpl(clazz.getName());
>>>> +   }
>>>> +
>>>> +   static LogProvider getLogProvider(String category, boolean 
>>>> wrapped)
>>>> +   {
>>>> +      return isLog4JAvailable ? new Log4JProvider(category, 
>>>> wrapped) : new JDKProvider(category, wrapped);
>>>> +   }
>>>> +
>>>> +   public static LogProvider getLogProvider(Class<?> clazz)
>>>> +   {
>>>> +      return getLogProvider(clazz.getName(), false);
>>>> +   }
>>>> +
>>>> +}
>>>>
>>>> Added: modules/trunk/parent/pom.xml
>>>> ===================================================================
>>>> --- modules/trunk/parent/pom.xml                            (rev 0)
>>>> +++ modules/trunk/parent/pom.xml    2009-04-21 09:38:36 UTC (rev 
>>>> 10542)
>>>> @@ -0,0 +1,206 @@
>>>> +<project xmlns="http://maven.apache.org/POM/4.0.0" 
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>>>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
>>>> http://maven.apache.org/maven-v4_0_0.xsd">
>>>> +   <modelVersion>4.0.0</modelVersion>
>>>> +   <groupId>org.jboss.seam</groupId>
>>>> +   <artifactId>seam-parent</artifactId>
>>>> +   <packaging>pom</packaging>
>>>> +   <version>3.0.0-SNAPSHOT</version>
>>>> +
>>>> +   <parent>
>>>> +      <groupId>org.jboss.seam</groupId>
>>>> +      <artifactId>seam-version-matrix</artifactId>
>>>> +      <version>3.0.0-SNAPSHOT</version>
>>>> +  </parent>
>>>> +
>>>> +   <name>JBoss Seam</name>
>>>> +   <url>http://www.seamframework.org</url>
>>>> +
>>>> +   <description>
>>>> +      JBoss Seam, an Enterprise Java Framework
>>>> +   </description>
>>>> +
>>>> +   <developers>
>>>> +      <developer>
>>>> +         <name>Pete Muir</name>
>>>> +         <roles>
>>>> +            <role>Project Lead</role>
>>>> +         </roles>
>>>> +         <email>pete.muir at jboss.org</email>
>>>> +         <organization>JBoss, a division of Red Hat</organization>
>>>> +         <url>http://in.relation.to/Bloggers/Pete</url>
>>>> +      </developer>
>>>> +
>>>> +      <developer>
>>>> +         <name>Shane Bryzak</name>
>>>> +         <organization>JBoss, a division of Red Hat</organization>
>>>> +      </developer>
>>>> +
>>>> +      <developer>
>>>> +         <name>Norman Richards</name>
>>>> +         <organization>JBoss, a division of Red Hat</organization>
>>>> +      </developer>
>>>> +
>>>> +      <developer>
>>>> +         <name>Dan Allen</name>
>>>> +         <organization>JBoss, a division of Red Hat</organization>
>>>> +      </developer>
>>>> +   </developers>
>>>> +
>>>> +   <build>
>>>> +      <plugins>
>>>> +         <plugin>
>>>> +            <groupId>org.apache.maven.plugins</groupId>
>>>> +            <artifactId>maven-source-plugin</artifactId>
>>>> +            <executions>
>>>> +               <execution>
>>>> +                  <id>attach-sources</id>
>>>> +                  <phase>verify</phase>
>>>> +                  <goals>
>>>> +                     <goal>jar</goal>
>>>> +                  </goals>
>>>> +               </execution>
>>>> +            </executions>
>>>> +         </plugin>
>>>> +         <plugin>
>>>> +            <groupId>org.apache.maven.plugins</groupId>
>>>> +            <artifactId>maven-enforcer-plugin</artifactId>
>>>> +         </plugin>
>>>> +         <plugin>
>>>> +           <groupId>org.apache.maven.plugins</groupId>
>>>> +           <artifactId>maven-release-plugin</artifactId>
>>>> +           <version>2.0-beta-8</version>
>>>> +           <configuration>
>>>> +             
>>>> <tagBase>https://svn.jboss.org/repos/webbeans/ri/tags</tagBase>
>>>> +             <autoVersionSubmodules>true</autoVersionSubmodules>
>>>> +           </configuration>
>>>> +         </plugin>
>>>> +      </plugins>
>>>> +      <defaultGoal>package</defaultGoal>
>>>> +
>>>> +      <pluginManagement>
>>>> +         <plugins>
>>>> +            <plugin>
>>>> +               <groupId>org.apache.maven.plugins</groupId>
>>>> +               <artifactId>maven-compiler-plugin</artifactId>
>>>> +               <configuration>
>>>> +                  <source>1.5</source>
>>>> +                  <target>1.5</target>
>>>> +               </configuration>
>>>> +            </plugin>
>>>> +            <plugin>
>>>> +               <groupId>org.apache.maven.plugins</groupId>
>>>> +               <artifactId>maven-jar-plugin</artifactId>
>>>> +               <configuration>
>>>> +                  <archive>
>>>> +                     <manifest>
>>>> +                        <addDefaultImplementationEntries>
>>>> +                           true
>>>> +                        </addDefaultImplementationEntries>
>>>> +                        <addDefaultSpecificationEntries>
>>>> +                           true
>>>> +                        </addDefaultSpecificationEntries>
>>>> +                     </manifest>
>>>> +                  </archive>
>>>> +               </configuration>
>>>> +            </plugin>
>>>> +            <plugin>
>>>> +               <groupId>org.codehaus.mojo</groupId>
>>>> +               <artifactId>emma-maven-plugin</artifactId>
>>>> +               <configuration>
>>>> +                  <forkMode>once</forkMode>
>>>> +                  <metadataFile>../target/coverage.em</metadataFile>
>>>> +                  
>>>> <outputDirectory>${project.build.directory}/generated-classes</outputDirectory> 
>>>>
>>>> +               </configuration>
>>>> +            </plugin>
>>>> +         </plugins>
>>>> +      </pluginManagement>
>>>> +   </build>
>>>> +
>>>> +   <profiles>
>>>> +      <profile>
>>>> +         <id>api-coverage</id>
>>>> +         <activation>
>>>> +            <property>
>>>> +               <name>apiCoverage</name>
>>>> +            </property>
>>>> +         </activation>
>>>> +         <build>
>>>> +            <plugins>
>>>> +               <plugin>
>>>> +                  <groupId>org.apache.maven.plugins</groupId>
>>>> +                  <artifactId>maven-surefire-plugin</artifactId>
>>>> +                  <inherited>true</inherited>
>>>> +                  <configuration>
>>>> +                     <forkMode>once</forkMode>
>>>> +                  </configuration>
>>>> +               </plugin>
>>>> +            </plugins>
>>>> +         </build>
>>>> +         <dependencies>
>>>> +            <dependency>
>>>> +               <groupId>emma</groupId>
>>>> +               <artifactId>emma</artifactId>
>>>> +               <version>2.0.5312</version>
>>>> +               <scope>test</scope>
>>>> +            </dependency>
>>>> +         </dependencies>
>>>> +      </profile>
>>>> +   </profiles>
>>>> +
>>>> +   <ciManagement>
>>>> +      <system>Hudson</system>
>>>> +      <url />
>>>> +   </ciManagement>
>>>> +
>>>> +   <issueManagement>
>>>> +      <system>JIRA</system>
>>>> +      <url>http://jira.jboss.org/browse/JBSEAM</url>
>>>> +   </issueManagement>
>>>> +
>>>> +   <inceptionYear>2008</inceptionYear>
>>>> +
>>>> +   <licenses>
>>>> +      <license>
>>>> +         <name>Lesser Gnu Public License, Version 2.1</name>
>>>> +         <url>http://www.gnu.org/licenses/lgpl-2.1.html</url>
>>>> +      </license>
>>>> +   </licenses>
>>>> +
>>>> +   <scm>
>>>> +      
>>>> <connection>scm:svn:http://anonsvn.jboss.org/repos/seam</connection>
>>>> +      
>>>> <developerConnection>scm:svn:https://svn.jboss.org/repos/seam</developerConnection> 
>>>>
>>>> +      <url>http://fisheye.jboss.org/browse/Seam</url>
>>>> +   </scm>
>>>> +
>>>> +   <distributionManagement>
>>>> +      <repository>
>>>> +         <!-- Copy the dist to the local checkout of the JBoss 
>>>> maven2 repo ${maven.repository.root} -->
>>>> +         <!-- It is anticipated that ${maven.repository.root} be 
>>>> set in user's settings.xml -->
>>>> +         <!-- todo : replace this with direct svn access once the 
>>>> svnkit providers are available -->
>>>> +         <id>repository.jboss.org</id>
>>>> +         <url>file://${maven.repository.root}</url>
>>>> +      </repository>
>>>> +      <snapshotRepository>
>>>> +         <id>snapshots.jboss.org</id>
>>>> +         <name>JBoss Snapshot Repository</name>
>>>> +         <url>dav:https://snapshots.jboss.org/maven2</url>
>>>> +      </snapshotRepository>
>>>> +   </distributionManagement>
>>>> +
>>>> +   <reporting>
>>>> +      <plugins>
>>>> +         <plugin>
>>>> +            <groupId>org.codehaus.mojo</groupId>
>>>> +            <artifactId>cobertura-maven-plugin</artifactId>
>>>> +            <configuration>
>>>> +               <formats>
>>>> +                  <format>html</format>
>>>> +                  <format>xml</format>
>>>> +               </formats>
>>>> +               <instrumentation>
>>>> +               </instrumentation>
>>>> +            </configuration>
>>>> +         </plugin>
>>>> +      </plugins>
>>>> +   </reporting>
>>>> +
>>>> +</project>
>>>>
>>>> Modified: modules/trunk/security/pom.xml
>>>> ===================================================================
>>>> --- modules/trunk/security/pom.xml    2009-04-21 08:51:33 UTC (rev 
>>>> 10541)
>>>> +++ modules/trunk/security/pom.xml    2009-04-21 09:38:36 UTC (rev 
>>>> 10542)
>>>> @@ -1,8 +1,13 @@
>>>> <project xmlns="http://maven.apache.org/POM/4.0.0"
>>>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
>>>> http://maven.apache.org/maven-v4_0_0.xsd">
>>>> -   <modelVersion>4.0.0</modelVersion>
>>>> -
>>>> +   <parent>
>>>> +      <artifactId>seam-parent</artifactId>
>>>> +      <groupId>org.jboss.seam</groupId>
>>>> +      <version>3.0.0-SNAPSHOT</version>
>>>> +   </parent>
>>>> +
>>>> +   <modelVersion>4.0.0</modelVersion>
>>>>   <groupId>org.jboss.seam</groupId>
>>>>   <artifactId>seam-security</artifactId>
>>>>   <packaging>jar</packaging>
>>>> @@ -13,7 +18,6 @@
>>>>      <dependency>
>>>>         <groupId>org.jboss.webbeans</groupId>
>>>>         <artifactId>jsr299-api</artifactId>
>>>> -         <version>1.0.0-SNAPSHOT</version>
>>>>      </dependency>
>>>>
>>>>   </dependencies>
>>>>
>>>> Modified: modules/trunk/version-matrix/pom.xml
>>>> ===================================================================
>>>> --- modules/trunk/version-matrix/pom.xml    2009-04-21 08:51:33 UTC 
>>>> (rev 10541)
>>>> +++ modules/trunk/version-matrix/pom.xml    2009-04-21 09:38:36 UTC 
>>>> (rev 10542)
>>>> @@ -51,7 +51,6 @@
>>>>
>>>>   <properties>
>>>>      <seam.version>3.0.0-SNAPSHOT</seam.version>
>>>> -      <webbeans.version>1.0.0-SNAPSHOT</webbeans.version>
>>>>   </properties>
>>>>
>>>>   <dependencyManagement>
>>>> @@ -141,31 +140,7 @@
>>>>            <artifactId>el-ri</artifactId>
>>>>            <version>1.2</version>
>>>>         </dependency>
>>>> -
>>>> -         <dependency>
>>>> -            <groupId>org.jboss.webbeans</groupId>
>>>> -            <artifactId>jsr299-api</artifactId>
>>>> -            <version>${webbeans.version}</version>
>>>> -         </dependency>
>>>>
>>>> -         <dependency>
>>>> -            <groupId>org.jboss.webbeans</groupId>
>>>> -            <artifactId>webbeans-core</artifactId>
>>>> -            <version>${webbeans.version}</version>
>>>> -         </dependency>
>>>> -
>>>> -         <dependency>
>>>> -            <groupId>org.jboss.webbeans</groupId>
>>>> -            <artifactId>webbeans-spi</artifactId>
>>>> -            <version>${webbeans.version}</version>
>>>> -         </dependency>
>>>> -
>>>> -         <dependency>
>>>> -            <groupId>org.jboss.webbeans</groupId>
>>>> -            <artifactId>webbeans-porting-package</artifactId>
>>>> -            <version>${webbeans.version}</version>
>>>> -         </dependency>
>>>> -
>>>>      </dependencies>
>>>>   </dependencyManagement>
>>>>
>>>>
>>>> _______________________________________________
>>>> seam-commits mailing list
>>>> seam-commits at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/seam-commits
>>>
>>> -- 
>>> Pete Muir
>>> http://www.seamframework.org
>>> http://in.relation.to/Bloggers/Pete
>>>
>>> _______________________________________________
>>> seam-dev mailing list
>>> seam-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>
>
> -- 
> Pete Muir
> http://www.seamframework.org
> http://in.relation.to/Bloggers/Pete
>




More information about the seam-dev mailing list