[jboss-svn-commits] JBoss Common SVN: r3379 - jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jul 16 19:12:11 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-07-16 19:12:11 -0400 (Thu, 16 Jul 2009)
New Revision: 3379

Modified:
   jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers/FileHandler.java
   jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandler.java
   jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers/SizeRotatingFileHandler.java
Log:
Add constructors to work around JBossMC's random-property-set-order issue

Modified: jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers/FileHandler.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers/FileHandler.java	2009-07-15 10:10:38 UTC (rev 3378)
+++ jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers/FileHandler.java	2009-07-16 23:12:11 UTC (rev 3379)
@@ -64,6 +64,42 @@
     }
 
     /**
+     * Construct a new instance with the given formatter, output file, and append setting.
+     *
+     * @param formatter the formatter
+     * @param file the file
+     * @param append {@code true} to append, {@code false} to overwrite
+     * @throws FileNotFoundException if the file could not be found on open
+     */
+    public FileHandler(final Formatter formatter, final File file, final boolean append) throws FileNotFoundException {
+        super(formatter);
+        this.append = append;
+        setFile(file);
+    }
+
+    /**
+     * Construct a new instance with the given output file.
+     *
+     * @param file the file
+     * @throws FileNotFoundException if the file could not be found on open
+     */
+    public FileHandler(final File file) throws FileNotFoundException {
+        setFile(file);
+    }
+
+    /**
+     * Construct a new instance with the given output file and append setting.
+     *
+     * @param file the file
+     * @param append {@code true} to append, {@code false} to overwrite
+     * @throws FileNotFoundException if the file could not be found on open
+     */
+    public FileHandler(final File file, final boolean append) throws FileNotFoundException {
+        this.append = append;
+        setFile(file);
+    }
+
+    /**
      * Specify whether to append to the target file.
      *
      * @param append {@code true} to append, {@code false} to overwrite

Modified: jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandler.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandler.java	2009-07-15 10:10:38 UTC (rev 3378)
+++ jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers/PeriodicRotatingFileHandler.java	2009-07-16 23:12:11 UTC (rev 3379)
@@ -42,6 +42,38 @@
     private Period period = Period.NEVER;
     private long nextRollover = Long.MAX_VALUE;
 
+    /**
+     * Construct a new instance with no formatter and no output file.
+     */
+    public PeriodicRotatingFileHandler() {
+    }
+
+    /**
+     * Construct a new instance with the given output file.
+     *
+     * @param file the file
+     * @param suffix the format suffix to use
+     *
+     * @throws java.io.FileNotFoundException if the file could not be found on open
+     */
+    public PeriodicRotatingFileHandler(final File file, final String suffix) throws FileNotFoundException {
+        super(file);
+        setSuffix(suffix);
+    }
+
+    /**
+     * Construct a new instance with the given output file and append setting.
+     *
+     * @param file the file
+     * @param suffix the format suffix to use
+     * @param append {@code true} to append, {@code false} to overwrite
+     * @throws java.io.FileNotFoundException if the file could not be found on open
+     */
+    public PeriodicRotatingFileHandler(final File file, final String suffix, final boolean append) throws FileNotFoundException {
+        super(file, append);
+        setSuffix(suffix);
+    }
+
     /** {@inheritDoc}  This implementation checks to see if the scheduled rollover time has yet occurred. */
     protected void preWrite(final ExtLogRecord record) {
         final long recordMillis = record.getMillis();

Modified: jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers/SizeRotatingFileHandler.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers/SizeRotatingFileHandler.java	2009-07-15 10:10:38 UTC (rev 3378)
+++ jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/handlers/SizeRotatingFileHandler.java	2009-07-16 23:12:11 UTC (rev 3379)
@@ -36,6 +36,70 @@
     private long currentSize;
     private int maxBackupIndex = 1;
 
+    /**
+     * Construct a new instance with no formatter and no output file.
+     */
+    public SizeRotatingFileHandler() {
+    }
+
+    /**
+     * Construct a new instance with the given output file.
+     *
+     * @param file the file
+     *
+     * @throws java.io.FileNotFoundException if the file could not be found on open
+     */
+    public SizeRotatingFileHandler(final File file) throws FileNotFoundException {
+        super(file);
+    }
+
+    /**
+     * Construct a new instance with the given output file and append setting.
+     *
+     * @param file the file
+     * @param append {@code true} to append, {@code false} to overwrite
+     *
+     * @throws java.io.FileNotFoundException if the file could not be found on open
+     */
+    public SizeRotatingFileHandler(final File file, final boolean append) throws FileNotFoundException {
+        super(file, append);
+    }
+
+    /**
+     * Construct a new instance with no formatter and no output file.
+     */
+    public SizeRotatingFileHandler(final long rotateSize, final int maxBackupIndex) {
+        this.rotateSize = rotateSize;
+        this.maxBackupIndex = maxBackupIndex;
+    }
+
+    /**
+     * Construct a new instance with the given output file.
+     *
+     * @param file the file
+     *
+     * @throws java.io.FileNotFoundException if the file could not be found on open
+     */
+    public SizeRotatingFileHandler(final File file, final long rotateSize, final int maxBackupIndex) throws FileNotFoundException {
+        super(file);
+        this.rotateSize = rotateSize;
+        this.maxBackupIndex = maxBackupIndex;
+    }
+
+    /**
+     * Construct a new instance with the given output file and append setting.
+     *
+     * @param file the file
+     * @param append {@code true} to append, {@code false} to overwrite
+     *
+     * @throws java.io.FileNotFoundException if the file could not be found on open
+     */
+    public SizeRotatingFileHandler(final File file, final boolean append, final long rotateSize, final int maxBackupIndex) throws FileNotFoundException {
+        super(file, append);
+        this.rotateSize = rotateSize;
+        this.maxBackupIndex = maxBackupIndex;
+    }
+
     /** {@inheritDoc} */
     public void setOutputStream(final OutputStream outputStream) {
         super.setOutputStream(outputStream == null ? null : new CountingOutputStream(outputStream));



More information about the jboss-svn-commits mailing list