diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-10 21:46:48 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-10 21:46:48 +0000 |
commit | ce57ab760f69de6db452def7ffbf5b114a2d8694 (patch) | |
tree | ea38c56431c5d4528fb54254c3f8e50f517bede3 /libjava/classpath/java/util/logging | |
parent | 50996fe55769882de3f410896032c887f0ff0d04 (diff) | |
download | ppe42-gcc-ce57ab760f69de6db452def7ffbf5b114a2d8694.tar.gz ppe42-gcc-ce57ab760f69de6db452def7ffbf5b114a2d8694.zip |
Imported GNU Classpath 0.90
* scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore.
* gnu/classpath/jdwp/VMFrame.java (SIZE): New constant.
* java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5.
* java/lang/Math.java: New override file.
* java/lang/Character.java: Merged from Classpath.
(start, end): Now 'int's.
(canonicalName): New field.
(CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants.
(UnicodeBlock): Added argument.
(of): New overload.
(forName): New method.
Updated unicode blocks.
(sets): Updated.
* sources.am: Regenerated.
* Makefile.in: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111942 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/util/logging')
-rw-r--r-- | libjava/classpath/java/util/logging/FileHandler.java | 2 | ||||
-rw-r--r-- | libjava/classpath/java/util/logging/LogManager.java | 53 | ||||
-rw-r--r-- | libjava/classpath/java/util/logging/SimpleFormatter.java | 10 |
3 files changed, 56 insertions, 9 deletions
diff --git a/libjava/classpath/java/util/logging/FileHandler.java b/libjava/classpath/java/util/logging/FileHandler.java index b03df97ec60..cde86191612 100644 --- a/libjava/classpath/java/util/logging/FileHandler.java +++ b/libjava/classpath/java/util/logging/FileHandler.java @@ -115,7 +115,7 @@ import java.util.ListIterator; * * <li><code>%h</code> - replaced by the location of the home * directory of the current user. This value is taken from the - * system property <code>file.separator</code>.</li> + * system property <code>user.home</code>.</li> * * <li><code>%g</code> - replaced by a generation number for * distinguisthing the individual items in the rotating set diff --git a/libjava/classpath/java/util/logging/LogManager.java b/libjava/classpath/java/util/logging/LogManager.java index b62292f7978..73eb9bcdd21 100644 --- a/libjava/classpath/java/util/logging/LogManager.java +++ b/libjava/classpath/java/util/logging/LogManager.java @@ -41,6 +41,7 @@ package java.util.logging; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.ref.WeakReference; @@ -295,6 +296,28 @@ public class LogManager if (parent != logger.getParent()) logger.setParent(parent); + // The level of the newly added logger must be specified. + // The easiest case is if there is a level for exactly this logger + // in the properties. If no such level exists the level needs to be + // searched along the hirachy. So if there is a new logger 'foo.blah.blub' + // and an existing parent logger 'foo' the properties 'foo.blah.blub.level' + // and 'foo.blah.level' need to be checked. If both do not exist in the + // properties the level of the new logger is set to 'null' (i.e. it uses the + // level of its parent 'foo'). + Level logLevel = logger.getLevel(); + String searchName = name; + String parentName = parent != null ? parent.getName() : ""; + while (logLevel == null && ! searchName.equals(parentName)) + { + logLevel = getLevelProperty(searchName + ".level", logLevel); + int index = searchName.lastIndexOf('.'); + if(index > -1) + searchName = searchName.substring(0,index); + else + searchName = ""; + } + logger.setLevel(logLevel); + /* It can happen that existing loggers should be children of * the newly added logger. For example, assume that there * already exist loggers under the names "", "foo", and "foo.bar.baz". @@ -488,23 +511,37 @@ public class LogManager path = System.getProperty("java.util.logging.config.file"); if ((path == null) || (path.length() == 0)) { - String url = (System.getProperty("gnu.classpath.home.url") - + "/logging.properties"); - inputStream = new URL(url).openStream(); + String url = (System.getProperty("gnu.classpath.home.url") + + "/logging.properties"); + try + { + inputStream = new URL(url).openStream(); + } + catch (Exception e) + { + inputStream=null; + } + + // If no config file could be found use a default configuration. + if(inputStream == null) + { + String defaultConfig = "handlers = java.util.logging.ConsoleHandler \n" + + ".level=INFO \n"; + inputStream = new ByteArrayInputStream(defaultConfig.getBytes()); + } } else inputStream = new java.io.FileInputStream(path); try { - readConfiguration(inputStream); + readConfiguration(inputStream); } finally { - /* Close the stream in order to save - * resources such as file descriptors. - */ - inputStream.close(); + // Close the stream in order to save + // resources such as file descriptors. + inputStream.close(); } } diff --git a/libjava/classpath/java/util/logging/SimpleFormatter.java b/libjava/classpath/java/util/logging/SimpleFormatter.java index ff53db8c055..2ebb1a1485f 100644 --- a/libjava/classpath/java/util/logging/SimpleFormatter.java +++ b/libjava/classpath/java/util/logging/SimpleFormatter.java @@ -39,6 +39,8 @@ exception statement from your version. */ package java.util.logging; +import java.io.PrintWriter; +import java.io.StringWriter; import java.text.DateFormat; import java.util.Date; @@ -114,6 +116,14 @@ public class SimpleFormatter buf.append(lineSep); + Throwable throwable = record.getThrown(); + if (throwable != null) + { + StringWriter sink = new StringWriter(); + throwable.printStackTrace(new PrintWriter(sink, true)); + buf.append(sink.toString()); + } + return buf.toString(); } } |