You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@excalibur.apache.org by vg...@apache.org on 2005/04/25 18:30:23 UTC

svn commit: r164597 - /excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/factory/FileTargetFactory.java

Author: vgritsenko
Date: Mon Apr 25 09:30:21 2005
New Revision: 164597

URL: http://svn.apache.org/viewcvs?rev=164597&view=rev
Log:
excalibur not in CVS anymore: update version line.
open up for extension: change private to protected,
introduce new method
protected LogTarget createTarget( final File file, final Configuration configuration )

Modified:
    excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/factory/FileTargetFactory.java   (contents, props changed)

Modified: excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/factory/FileTargetFactory.java
URL: http://svn.apache.org/viewcvs/excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/factory/FileTargetFactory.java?rev=164597&r1=164596&r2=164597&view=diff
==============================================================================
--- excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/factory/FileTargetFactory.java (original)
+++ excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/factory/FileTargetFactory.java Mon Apr 25 09:30:21 2005
@@ -1,16 +1,16 @@
 /*
- * Copyright 2002-2004 The Apache Software Foundation
+ * Copyright 2002-2005 The Apache Software Foundation
  * Licensed  under the  Apache License,  Version 2.0  (the "License");
  * you may not use  this file  except in  compliance with the License.
- * You may obtain a copy of the License at 
- * 
+ * You may obtain a copy of the License at
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed  under the  License is distributed on an "AS IS" BASIS,
  * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
  * implied.
- * 
+ *
  * See the License for the specific language governing permissions and
  * limitations under the License.
 */
@@ -125,7 +125,7 @@
  * </dl>
  *
  * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
- * @version CVS $Revision: 1.13 $ $Date: 2004/03/10 13:54:50 $
+ * @version SVN $Id$
  * @since 4.0
  */
 public class FileTargetFactory
@@ -140,21 +140,25 @@
     {
         final Configuration confFilename = configuration.getChild( "filename" );
         final String filename = getFilename( confFilename.getValue() );
+        final File file = new File( filename );
 
-        final Configuration confRotation = configuration.getChild( "rotation", false );
-
-        final Configuration confFormat = configuration.getChild( "format" );
+        final LogTarget logtarget = createTarget( file, configuration );
+        return logtarget;
+    }
 
+    protected LogTarget createTarget( final File file, final Configuration configuration )
+        throws ConfigurationException
+    {
         final Configuration confAppend = configuration.getChild( "append" );
         final boolean append = confAppend.getValueAsBoolean( false );
 
-        final LogTarget logtarget;
-
-        final File file = new File( filename );
+        final Configuration confFormat = configuration.getChild( "format" );
         final Formatter formatter = getFormatter( confFormat );
 
+        final LogTarget logtarget;
         try
         {
+            final Configuration confRotation = configuration.getChild( "rotation", false );
             if( null == confRotation )
             {
                 logtarget = new FileTarget( file, append, formatter );
@@ -163,7 +167,7 @@
             {
                 if( confRotation.getChildren().length == 0 )
                 {
-                    final String error = 
+                    final String error =
                       "Missing file rotation strategy element [or|size|date|interval|time]";
                     throw new ConfigurationException( error );
                 }
@@ -191,7 +195,7 @@
     private static final long KILOBYTE = 1000;
     private static final long MEGABYTE = 1000 * KILOBYTE;
 
-    private RotateStrategy getRotateStrategy( final Configuration conf )
+    protected RotateStrategy getRotateStrategy( final Configuration conf )
     {
         final String type = conf.getName();
 

Propchange: excalibur/trunk/containerkit/logger/src/java/org/apache/avalon/excalibur/logger/factory/FileTargetFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
To unsubscribe, e-mail: scm-unsubscribe@excalibur.apache.org
For additional commands, e-mail: scm-help@excalibur.apache.org