summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaif S. Naffah <raif@swiftdsl.com.au>2006-05-28 08:28:03 +0000
committerRaif S. Naffah <raif@swiftdsl.com.au>2006-05-28 08:28:03 +0000
commit6b816f558c1df209470b7b803051a76c4258991f (patch)
tree935cdc855e160b20c23904e7c30dc27ac468653e
parentac27bece1e7906c8b88ed88e4d5167e1f5f8bd3d (diff)
downloadclasspath-6b816f558c1df209470b7b803051a76c4258991f.tar.gz
2006-05-28 Raif S. Naffah <raif@swiftdsl.com.au>
* java/util/logging/FileHandler.java (PATTERN_KEY): New constant. (DEFAULT_PATTERN): Likewise. (FileHandler()): Use configured pattern property if any; otherwise use a default value as per RI documentation. * java/util/logging/LogManager.java (getStringProperty): New method.
-rw-r--r--ChangeLog8
-rw-r--r--java/util/logging/FileHandler.java14
-rw-r--r--java/util/logging/LogManager.java16
3 files changed, 36 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 46616b8b4..c9ddd6acc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-05-28 Raif S. Naffah <raif@swiftdsl.com.au>
+
+ * java/util/logging/FileHandler.java (PATTERN_KEY): New constant.
+ (DEFAULT_PATTERN): Likewise.
+ (FileHandler()): Use configured pattern property if any; otherwise use a
+ default value as per RI documentation.
+ * java/util/logging/LogManager.java (getStringProperty): New method.
+
2006-05-27 Thomas Fitzsimmons <fitzsim@redhat.com>
* NEWS: Announce libjawtgnu.so-to-libjawt.so rename.
diff --git a/java/util/logging/FileHandler.java b/java/util/logging/FileHandler.java
index cde861916..1b7711eb3 100644
--- a/java/util/logging/FileHandler.java
+++ b/java/util/logging/FileHandler.java
@@ -192,6 +192,17 @@ public class FileHandler
extends StreamHandler
{
/**
+ * The name of the property to set for specifying a file naming (incl. path)
+ * pattern to use with rotating log files.
+ */
+ private static final String PATTERN_KEY = "java.util.logging.FileHandler.pattern";
+ /**
+ * The default pattern to use when the <code>PATTERN_KEY</code> property was
+ * not specified in the logging.properties file.
+ */
+ private static final String DEFAULT_PATTERN = "%h/java%u.log";
+
+ /**
* The number of bytes a log file is approximately allowed to reach
* before it is closed and the handler switches to the next file in
* the rotating set. A value of zero means that files can grow
@@ -252,8 +263,7 @@ public class FileHandler
public FileHandler()
throws IOException, SecurityException
{
- this(/* pattern: use configiguration */ null,
-
+ this(LogManager.getStringProperty(PATTERN_KEY, DEFAULT_PATTERN),
LogManager.getIntProperty("java.util.logging.FileHandler.limit",
/* default */ 0),
diff --git a/java/util/logging/LogManager.java b/java/util/logging/LogManager.java
index e2604815b..79122731d 100644
--- a/java/util/logging/LogManager.java
+++ b/java/util/logging/LogManager.java
@@ -777,6 +777,22 @@ public class LogManager
}
/**
+ * Returns the value of a configuration property as a String.
+ * <p>
+ * This function is a helper used by the Classpath implementation of
+ * java.util.logging, it is <em>not</em> specified in the logging API.
+ *
+ * @param name the name of the configuration property to fetch.
+ * @param defaultValue the value that will be returned if the property is not
+ * defined.
+ */
+ static String getStringProperty(String name, String defaultValue)
+ {
+ String result = getLogManager().getProperty(name);
+ return result == null ? defaultValue : result;
+ }
+
+ /**
* An instance of <code>LoggingPermission("control")</code>
* that is shared between calls to <code>checkAccess()</code>.
*/