summaryrefslogtreecommitdiff
path: root/libjava/java/util/logging
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/java/util/logging
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libjava/java/util/logging')
-rw-r--r--libjava/java/util/logging/ConsoleHandler.h21
-rw-r--r--libjava/java/util/logging/ErrorManager.h29
-rw-r--r--libjava/java/util/logging/FileHandler$ostr.h28
-rw-r--r--libjava/java/util/logging/FileHandler.h49
-rw-r--r--libjava/java/util/logging/Filter.h19
-rw-r--r--libjava/java/util/logging/Formatter.h24
-rw-r--r--libjava/java/util/logging/Handler.h44
-rw-r--r--libjava/java/util/logging/Level.h53
-rw-r--r--libjava/java/util/logging/LogManager$1.h24
-rw-r--r--libjava/java/util/logging/LogManager.h77
-rw-r--r--libjava/java/util/logging/LogManager.java991
-rw-r--r--libjava/java/util/logging/LogRecord.h70
-rw-r--r--libjava/java/util/logging/Logger$1.h21
-rw-r--r--libjava/java/util/logging/Logger.h90
-rw-r--r--libjava/java/util/logging/Logger.java1206
-rw-r--r--libjava/java/util/logging/LoggingMXBean.h22
-rw-r--r--libjava/java/util/logging/LoggingPermission.h22
-rw-r--r--libjava/java/util/logging/MemoryHandler.h35
-rw-r--r--libjava/java/util/logging/SimpleFormatter.h35
-rw-r--r--libjava/java/util/logging/SocketHandler.h25
-rw-r--r--libjava/java/util/logging/StreamHandler.h43
-rw-r--r--libjava/java/util/logging/XMLFormatter.h50
-rw-r--r--libjava/java/util/logging/natLogger.cc49
23 files changed, 3027 insertions, 0 deletions
diff --git a/libjava/java/util/logging/ConsoleHandler.h b/libjava/java/util/logging/ConsoleHandler.h
new file mode 100644
index 000000000..0d1bbe02d
--- /dev/null
+++ b/libjava/java/util/logging/ConsoleHandler.h
@@ -0,0 +1,21 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_ConsoleHandler__
+#define __java_util_logging_ConsoleHandler__
+
+#pragma interface
+
+#include <java/util/logging/StreamHandler.h>
+
+class java::util::logging::ConsoleHandler : public ::java::util::logging::StreamHandler
+{
+
+public:
+ ConsoleHandler();
+ virtual void close();
+ virtual void publish(::java::util::logging::LogRecord *);
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_ConsoleHandler__
diff --git a/libjava/java/util/logging/ErrorManager.h b/libjava/java/util/logging/ErrorManager.h
new file mode 100644
index 000000000..58d48c9e2
--- /dev/null
+++ b/libjava/java/util/logging/ErrorManager.h
@@ -0,0 +1,29 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_ErrorManager__
+#define __java_util_logging_ErrorManager__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::util::logging::ErrorManager : public ::java::lang::Object
+{
+
+public:
+ ErrorManager();
+ virtual void error(::java::lang::String *, ::java::lang::Exception *, jint);
+ static const jint GENERIC_FAILURE = 0;
+ static const jint WRITE_FAILURE = 1;
+ static const jint FLUSH_FAILURE = 2;
+ static const jint CLOSE_FAILURE = 3;
+ static const jint OPEN_FAILURE = 4;
+ static const jint FORMAT_FAILURE = 5;
+private:
+ jboolean volatile __attribute__((aligned(__alignof__( ::java::lang::Object)))) everUsed;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_ErrorManager__
diff --git a/libjava/java/util/logging/FileHandler$ostr.h b/libjava/java/util/logging/FileHandler$ostr.h
new file mode 100644
index 000000000..e34a3db87
--- /dev/null
+++ b/libjava/java/util/logging/FileHandler$ostr.h
@@ -0,0 +1,28 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_FileHandler$ostr__
+#define __java_util_logging_FileHandler$ostr__
+
+#pragma interface
+
+#include <java/io/FilterOutputStream.h>
+#include <gcj/array.h>
+
+
+class java::util::logging::FileHandler$ostr : public ::java::io::FilterOutputStream
+{
+
+ FileHandler$ostr(::java::util::logging::FileHandler *, ::java::io::OutputStream *);
+public:
+ void write(jint);
+ void write(JArray< jbyte > *);
+ void write(JArray< jbyte > *, jint, jint);
+public: // actually package-private
+ FileHandler$ostr(::java::util::logging::FileHandler *, ::java::io::OutputStream *, ::java::util::logging::FileHandler$ostr *);
+ ::java::util::logging::FileHandler * __attribute__((aligned(__alignof__( ::java::io::FilterOutputStream)))) this$0;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_FileHandler$ostr__
diff --git a/libjava/java/util/logging/FileHandler.h b/libjava/java/util/logging/FileHandler.h
new file mode 100644
index 000000000..16feec2b2
--- /dev/null
+++ b/libjava/java/util/logging/FileHandler.h
@@ -0,0 +1,49 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_FileHandler__
+#define __java_util_logging_FileHandler__
+
+#pragma interface
+
+#include <java/util/logging/StreamHandler.h>
+
+class java::util::logging::FileHandler : public ::java::util::logging::StreamHandler
+{
+
+public:
+ FileHandler();
+ FileHandler(::java::lang::String *);
+ FileHandler(::java::lang::String *, jboolean);
+ FileHandler(::java::lang::String *, jint, jint);
+ FileHandler(::java::lang::String *, jint, jint, jboolean);
+private:
+ ::java::io::OutputStream * createFileStream(::java::lang::String *, jint, jint, jboolean, jint);
+ static ::java::lang::String * replaceFileNameEscapes(::java::lang::String *, jint, jint, jint);
+public:
+ virtual void publish(::java::util::logging::LogRecord *);
+private:
+ void rotate();
+ static jboolean has(::java::lang::String *, jchar);
+ static ::java::lang::String * PROPERTY_PREFIX;
+ static ::java::lang::String * PATTERN_KEY;
+ static ::java::lang::String * DEFAULT_PATTERN;
+ static ::java::lang::String * LIMIT_KEY;
+ static const jint DEFAULT_LIMIT = 0;
+ static ::java::lang::String * COUNT_KEY;
+ static const jint DEFAULT_COUNT = 1;
+ static ::java::lang::String * APPEND_KEY;
+ static const jboolean DEFAULT_APPEND = 0;
+ jint __attribute__((aligned(__alignof__( ::java::util::logging::StreamHandler)))) limit;
+ jint count;
+ ::java::lang::String * pattern;
+ jboolean append;
+public: // actually package-private
+ jlong written;
+private:
+ ::java::util::LinkedList * logFiles;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_FileHandler__
diff --git a/libjava/java/util/logging/Filter.h b/libjava/java/util/logging/Filter.h
new file mode 100644
index 000000000..23b8ca6a1
--- /dev/null
+++ b/libjava/java/util/logging/Filter.h
@@ -0,0 +1,19 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_Filter__
+#define __java_util_logging_Filter__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::util::logging::Filter : public ::java::lang::Object
+{
+
+public:
+ virtual jboolean isLoggable(::java::util::logging::LogRecord *) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_util_logging_Filter__
diff --git a/libjava/java/util/logging/Formatter.h b/libjava/java/util/logging/Formatter.h
new file mode 100644
index 000000000..def22454c
--- /dev/null
+++ b/libjava/java/util/logging/Formatter.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_Formatter__
+#define __java_util_logging_Formatter__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::util::logging::Formatter : public ::java::lang::Object
+{
+
+public: // actually protected
+ Formatter();
+public:
+ virtual ::java::lang::String * format(::java::util::logging::LogRecord *) = 0;
+ virtual ::java::lang::String * getHead(::java::util::logging::Handler *);
+ virtual ::java::lang::String * getTail(::java::util::logging::Handler *);
+ virtual ::java::lang::String * formatMessage(::java::util::logging::LogRecord *);
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_Formatter__
diff --git a/libjava/java/util/logging/Handler.h b/libjava/java/util/logging/Handler.h
new file mode 100644
index 000000000..2c722be60
--- /dev/null
+++ b/libjava/java/util/logging/Handler.h
@@ -0,0 +1,44 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_Handler__
+#define __java_util_logging_Handler__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::util::logging::Handler : public ::java::lang::Object
+{
+
+public: // actually protected
+ Handler();
+public:
+ virtual void publish(::java::util::logging::LogRecord *) = 0;
+ virtual void flush() = 0;
+ virtual void close() = 0;
+ virtual ::java::util::logging::Formatter * getFormatter();
+ virtual void setFormatter(::java::util::logging::Formatter *);
+ virtual ::java::lang::String * getEncoding();
+ virtual void setEncoding(::java::lang::String *);
+ virtual ::java::util::logging::Filter * getFilter();
+ virtual void setFilter(::java::util::logging::Filter *);
+ virtual ::java::util::logging::ErrorManager * getErrorManager();
+ virtual void setErrorManager(::java::util::logging::ErrorManager *);
+public: // actually protected
+ virtual void reportError(::java::lang::String *, ::java::lang::Exception *, jint);
+public:
+ virtual ::java::util::logging::Level * getLevel();
+ virtual void setLevel(::java::util::logging::Level *);
+ virtual jboolean isLoggable(::java::util::logging::LogRecord *);
+public: // actually package-private
+ ::java::util::logging::Formatter * __attribute__((aligned(__alignof__( ::java::lang::Object)))) formatter;
+ ::java::util::logging::Filter * filter;
+ ::java::util::logging::Level * level;
+ ::java::util::logging::ErrorManager * errorManager;
+ ::java::lang::String * encoding;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_Handler__
diff --git a/libjava/java/util/logging/Level.h b/libjava/java/util/logging/Level.h
new file mode 100644
index 000000000..34f516093
--- /dev/null
+++ b/libjava/java/util/logging/Level.h
@@ -0,0 +1,53 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_Level__
+#define __java_util_logging_Level__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::util::logging::Level : public ::java::lang::Object
+{
+
+public: // actually protected
+ Level(::java::lang::String *, jint);
+ Level(::java::lang::String *, jint, ::java::lang::String *);
+private:
+ ::java::lang::Object * readResolve();
+public:
+ virtual ::java::lang::String * getResourceBundleName();
+ virtual ::java::lang::String * getName();
+ virtual ::java::lang::String * getLocalizedName();
+ virtual ::java::lang::String * toString();
+ virtual jint intValue();
+ static ::java::util::logging::Level * parse(::java::lang::String *);
+ virtual jboolean equals(::java::lang::Object *);
+ virtual jint hashCode();
+public: // actually package-private
+ virtual jboolean isStandardLevel();
+public:
+ static ::java::util::logging::Level * OFF;
+ static ::java::util::logging::Level * SEVERE;
+ static ::java::util::logging::Level * WARNING;
+ static ::java::util::logging::Level * INFO;
+ static ::java::util::logging::Level * CONFIG;
+ static ::java::util::logging::Level * FINE;
+ static ::java::util::logging::Level * FINER;
+ static ::java::util::logging::Level * FINEST;
+ static ::java::util::logging::Level * ALL;
+private:
+ static JArray< ::java::util::logging::Level * > * knownLevels;
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) name;
+ jint value;
+ ::java::lang::String * resourceBundleName;
+public: // actually package-private
+ static const jlong serialVersionUID = -8176160795706313070LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_Level__
diff --git a/libjava/java/util/logging/LogManager$1.h b/libjava/java/util/logging/LogManager$1.h
new file mode 100644
index 000000000..0d1ed2152
--- /dev/null
+++ b/libjava/java/util/logging/LogManager$1.h
@@ -0,0 +1,24 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_LogManager$1__
+#define __java_util_logging_LogManager$1__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::util::logging::LogManager$1 : public ::java::lang::Object
+{
+
+public: // actually package-private
+ LogManager$1();
+public:
+ virtual ::java::lang::String * getLoggerLevel(::java::lang::String *);
+ virtual ::java::util::List * getLoggerNames();
+ virtual ::java::lang::String * getParentLoggerName(::java::lang::String *);
+ virtual void setLoggerLevel(::java::lang::String *, ::java::lang::String *);
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_LogManager$1__
diff --git a/libjava/java/util/logging/LogManager.h b/libjava/java/util/logging/LogManager.h
new file mode 100644
index 000000000..f552d65d7
--- /dev/null
+++ b/libjava/java/util/logging/LogManager.h
@@ -0,0 +1,77 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_LogManager__
+#define __java_util_logging_LogManager__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace beans
+ {
+ class PropertyChangeListener;
+ class PropertyChangeSupport;
+ }
+ }
+}
+
+class java::util::logging::LogManager : public ::java::lang::Object
+{
+
+public: // actually protected
+ LogManager();
+public:
+ static ::java::util::logging::LogManager * getLogManager();
+private:
+ static ::java::util::logging::LogManager * makeLogManager();
+ static void initLogManager();
+public:
+ virtual void addPropertyChangeListener(::java::beans::PropertyChangeListener *);
+ virtual void removePropertyChangeListener(::java::beans::PropertyChangeListener *);
+ virtual jboolean addLogger(::java::util::logging::Logger *);
+private:
+ ::java::util::logging::Logger * findAncestor(::java::util::logging::Logger *);
+public:
+ virtual ::java::util::logging::Logger * getLogger(::java::lang::String *);
+ virtual ::java::util::Enumeration * getLoggerNames();
+ virtual void reset();
+ virtual void readConfiguration();
+ virtual void readConfiguration(::java::io::InputStream *);
+ virtual ::java::lang::String * getProperty(::java::lang::String *);
+public: // actually package-private
+ static jint getIntProperty(::java::lang::String *, jint);
+ static jint getIntPropertyClamped(::java::lang::String *, jint, jint, jint);
+ static jboolean getBooleanProperty(::java::lang::String *, jboolean);
+ static ::java::util::logging::Level * getLevelProperty(::java::lang::String *, ::java::util::logging::Level *);
+ static ::java::lang::Class * getClassProperty(::java::lang::String *, ::java::lang::Class *);
+ static ::java::lang::Object * getInstanceProperty(::java::lang::String *, ::java::lang::Class *, ::java::lang::Class *);
+public:
+ virtual void checkAccess();
+private:
+ static ::java::lang::Object * createInstance(::java::lang::String *, ::java::lang::Class *, ::java::lang::String *);
+ static void warn(::java::lang::String *, ::java::lang::String *, ::java::lang::Throwable *);
+ static void warn(::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ static void warn(::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::Throwable *);
+ static void warn(::java::lang::String *, ::java::lang::Throwable *);
+ static ::java::lang::Class * locateClass(::java::lang::String *);
+public:
+ static ::java::util::logging::LoggingMXBean * getLoggingMXBean();
+ static ::java::lang::String * LOGGING_MXBEAN_NAME;
+private:
+ static ::java::util::logging::LogManager * logManager;
+ static ::java::util::logging::LoggingMXBean * loggingBean;
+ ::java::util::Map * __attribute__((aligned(__alignof__( ::java::lang::Object)))) loggers;
+ ::java::util::Properties * properties;
+ ::java::beans::PropertyChangeSupport * pcs;
+ static ::java::lang::String * MANAGER_PROPERTY;
+ static ::java::lang::String * CONFIG_PROPERTY;
+ static ::java::util::logging::LoggingPermission * controlPermission;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_LogManager__
diff --git a/libjava/java/util/logging/LogManager.java b/libjava/java/util/logging/LogManager.java
new file mode 100644
index 000000000..811310c70
--- /dev/null
+++ b/libjava/java/util/logging/LogManager.java
@@ -0,0 +1,991 @@
+/* LogManager.java -- a class for maintaining Loggers and managing
+ configuration properties
+ Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util.logging;
+
+import gnu.classpath.SystemProperties;
+
+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;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+/**
+ * The <code>LogManager</code> maintains a hierarchical namespace
+ * of Logger objects and manages properties for configuring the logging
+ * framework. There exists only one single <code>LogManager</code>
+ * per virtual machine. This instance can be retrieved using the
+ * static method {@link #getLogManager()}.
+ *
+ * <p><strong>Configuration Process:</strong> The global LogManager
+ * object is created and configured when the class
+ * <code>java.util.logging.LogManager</code> is initialized.
+ * The configuration process includes the subsequent steps:
+ *
+ * <ul>
+ * <li>If the system property <code>java.util.logging.manager</code>
+ * is set to the name of a subclass of
+ * <code>java.util.logging.LogManager</code>, an instance of
+ * that subclass is created and becomes the global LogManager.
+ * Otherwise, a new instance of LogManager is created.</li>
+ * <li>The <code>LogManager</code> constructor tries to create
+ * a new instance of the class specified by the system
+ * property <code>java.util.logging.config.class</code>.
+ * Typically, the constructor of this class will call
+ * <code>LogManager.getLogManager().readConfiguration(java.io.InputStream)</code>
+ * for configuring the logging framework.
+ * The configuration process stops at this point if
+ * the system property <code>java.util.logging.config.class</code>
+ * is set (irrespective of whether the class constructor
+ * could be called or an exception was thrown).</li>
+ *
+ * <li>If the system property <code>java.util.logging.config.class</code>
+ * is <em>not</em> set, the configuration parameters are read in from
+ * a file and passed to
+ * {@link #readConfiguration(java.io.InputStream)}.
+ * The name and location of this file are specified by the system
+ * property <code>java.util.logging.config.file</code>.</li>
+ * <li>If the system property <code>java.util.logging.config.file</code>
+ * is not set, however, the contents of the URL
+ * "{gnu.classpath.home.url}/logging.properties" are passed to
+ * {@link #readConfiguration(java.io.InputStream)}.
+ * Here, "{gnu.classpath.home.url}" stands for the value of
+ * the system property <code>gnu.classpath.home.url</code>.</li>
+ * </ul>
+ *
+ * <p>The <code>LogManager</code> has a level of <code>INFO</code> by
+ * default, and this will be inherited by <code>Logger</code>s unless they
+ * override it either by properties or programmatically.
+ *
+ * @author Sascha Brawer (brawer@acm.org)
+ */
+public class LogManager
+{
+ /**
+ * The object name for the logging management bean.
+ * @since 1.5
+ */
+ public static final String LOGGING_MXBEAN_NAME
+ = "java.util.logging:type=Logging";
+
+ /**
+ * The singleton LogManager instance.
+ */
+ private static LogManager logManager;
+
+ /**
+ * The singleton logging bean.
+ */
+ private static LoggingMXBean loggingBean;
+
+ /**
+ * The registered named loggers; maps the name of a Logger to
+ * a WeakReference to it.
+ */
+ private Map<String, WeakReference<Logger>> loggers;
+
+ /**
+ * The properties for the logging framework which have been
+ * read in last.
+ */
+ private Properties properties;
+
+ /**
+ * A delegate object that provides support for handling
+ * PropertyChangeEvents. The API specification does not
+ * mention which bean should be the source in the distributed
+ * PropertyChangeEvents, but Mauve test code has determined that
+ * the Sun J2SE 1.4 reference implementation uses the LogManager
+ * class object. This is somewhat strange, as the class object
+ * is not the bean with which listeners have to register, but
+ * there is no reason for the GNU Classpath implementation to
+ * behave differently from the reference implementation in
+ * this case.
+ */
+ private final PropertyChangeSupport pcs = new PropertyChangeSupport( /* source bean */
+ LogManager.class);
+
+ protected LogManager()
+ {
+ loggers = new HashMap();
+ }
+
+ /**
+ * Returns the globally shared LogManager instance.
+ */
+ public static synchronized LogManager getLogManager()
+ {
+ if (logManager == null)
+ {
+ logManager = makeLogManager();
+ initLogManager();
+ }
+ return logManager;
+ }
+
+ private static final String MANAGER_PROPERTY = "java.util.logging.manager";
+
+ private static LogManager makeLogManager()
+ {
+ String managerClassName = SystemProperties.getProperty(MANAGER_PROPERTY);
+ LogManager manager = (LogManager) createInstance
+ (managerClassName, LogManager.class, MANAGER_PROPERTY);
+ if (manager == null)
+ manager = new LogManager();
+ return manager;
+ }
+
+ private static final String CONFIG_PROPERTY = "java.util.logging.config.class";
+
+ private static void initLogManager()
+ {
+ LogManager manager = getLogManager();
+ Logger.root.setLevel(Level.INFO);
+ manager.addLogger(Logger.root);
+
+ /* The Javadoc description of the class explains
+ * what is going on here.
+ */
+ Object configurator = createInstance(System.getProperty(CONFIG_PROPERTY),
+ /* must be instance of */ Object.class,
+ CONFIG_PROPERTY);
+
+ try
+ {
+ if (configurator == null)
+ manager.readConfiguration();
+ }
+ catch (IOException ex)
+ {
+ /* FIXME: Is it ok to ignore exceptions here? */
+ }
+ }
+
+ /**
+ * Registers a listener which will be notified when the
+ * logging properties are re-read.
+ */
+ public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ /* do not register null. */
+ listener.getClass();
+
+ pcs.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Unregisters a listener.
+ *
+ * If <code>listener</code> has not been registered previously,
+ * nothing happens. Also, no exception is thrown if
+ * <code>listener</code> is <code>null</code>.
+ */
+ public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
+ {
+ if (listener != null)
+ pcs.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Adds a named logger. If a logger with the same name has
+ * already been registered, the method returns <code>false</code>
+ * without adding the logger.
+ *
+ * <p>The <code>LogManager</code> only keeps weak references
+ * to registered loggers. Therefore, names can become available
+ * after automatic garbage collection.
+ *
+ * @param logger the logger to be added.
+ *
+ * @return <code>true</code>if <code>logger</code> was added,
+ * <code>false</code> otherwise.
+ *
+ * @throws NullPointerException if <code>name</code> is
+ * <code>null</code>.
+ */
+ public synchronized boolean addLogger(Logger logger)
+ {
+ /* To developers thinking about to remove the 'synchronized'
+ * declaration from this method: Please read the comment
+ * in java.util.logging.Logger.getLogger(String, String)
+ * and make sure that whatever you change wrt. synchronization
+ * does not endanger thread-safety of Logger.getLogger.
+ * The current implementation of Logger.getLogger assumes
+ * that LogManager does its synchronization on the globally
+ * shared instance of LogManager.
+ */
+ String name;
+ WeakReference ref;
+
+ /* This will throw a NullPointerException if logger is null,
+ * as required by the API specification.
+ */
+ name = logger.getName();
+
+ ref = loggers.get(name);
+ if (ref != null)
+ {
+ if (ref.get() != null)
+ return false;
+
+ /* There has been a logger under this name in the past,
+ * but it has been garbage collected.
+ */
+ loggers.remove(ref);
+ }
+
+ /* Adding a named logger requires a security permission. */
+ if ((name != null) && ! name.equals(""))
+ checkAccess();
+
+ Logger parent = findAncestor(logger);
+ loggers.put(name, new WeakReference<Logger>(logger));
+ 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".
+ * When adding "foo.bar", the logger "foo.bar.baz" should change
+ * its parent to "foo.bar".
+ */
+ for (Iterator iter = loggers.keySet().iterator(); iter.hasNext();)
+ {
+ Logger possChild = (Logger) ((WeakReference) loggers.get(iter.next()))
+ .get();
+ if ((possChild == null) || (possChild == logger)
+ || (possChild.getParent() != parent))
+ continue;
+
+ if (! possChild.getName().startsWith(name))
+ continue;
+
+ if (possChild.getName().charAt(name.length()) != '.')
+ continue;
+
+ possChild.setParent(logger);
+ }
+
+ return true;
+ }
+
+ /**
+ * Finds the closest ancestor for a logger among the currently
+ * registered ones. For example, if the currently registered
+ * loggers have the names "", "foo", and "foo.bar", the result for
+ * "foo.bar.baz" will be the logger whose name is "foo.bar".
+ *
+ * @param child a logger for whose name no logger has been
+ * registered.
+ *
+ * @return the closest ancestor for <code>child</code>,
+ * or <code>null</code> if <code>child</code>
+ * is the root logger.
+ *
+ * @throws NullPointerException if <code>child</code>
+ * is <code>null</code>.
+ */
+ private synchronized Logger findAncestor(Logger child)
+ {
+ String childName = child.getName();
+ int childNameLength = childName.length();
+ Logger best = Logger.root;
+ int bestNameLength = 0;
+
+ Logger cand;
+ int candNameLength;
+
+ if (child == Logger.root)
+ return null;
+
+ for (String candName : loggers.keySet())
+ {
+ candNameLength = candName.length();
+
+ if (candNameLength > bestNameLength
+ && childNameLength > candNameLength
+ && childName.startsWith(candName)
+ && childName.charAt(candNameLength) == '.')
+ {
+ cand = loggers.get(candName).get();
+ if ((cand == null) || (cand == child))
+ continue;
+
+ bestNameLength = candName.length();
+ best = cand;
+ }
+ }
+
+ return best;
+ }
+
+ /**
+ * Returns a Logger given its name.
+ *
+ * @param name the name of the logger.
+ *
+ * @return a named Logger, or <code>null</code> if there is no
+ * logger with that name.
+ *
+ * @throw java.lang.NullPointerException if <code>name</code>
+ * is <code>null</code>.
+ */
+ public synchronized Logger getLogger(String name)
+ {
+ WeakReference<Logger> ref;
+
+ /* Throw a NullPointerException if name is null. */
+ name.getClass();
+
+ ref = loggers.get(name);
+ if (ref != null)
+ return ref.get();
+ else
+ return null;
+ }
+
+ /**
+ * Returns an Enumeration of currently registered Logger names.
+ * Since other threads can register loggers at any time, the
+ * result could be different any time this method is called.
+ *
+ * @return an Enumeration with the names of the currently
+ * registered Loggers.
+ */
+ public synchronized Enumeration<String> getLoggerNames()
+ {
+ return Collections.enumeration(loggers.keySet());
+ }
+
+ /**
+ * Resets the logging configuration by removing all handlers for
+ * registered named loggers and setting their level to <code>null</code>.
+ * The level of the root logger will be set to <code>Level.INFO</code>.
+ *
+ * @throws SecurityException if a security manager exists and
+ * the caller is not granted the permission to control
+ * the logging infrastructure.
+ */
+ public synchronized void reset() throws SecurityException
+ {
+ /* Throw a SecurityException if the caller does not have the
+ * permission to control the logging infrastructure.
+ */
+ checkAccess();
+
+ properties = new Properties();
+
+ Iterator<WeakReference<Logger>> iter = loggers.values().iterator();
+ while (iter.hasNext())
+ {
+ WeakReference<Logger> ref;
+ Logger logger;
+
+ ref = iter.next();
+ if (ref != null)
+ {
+ logger = ref.get();
+
+ if (logger == null)
+ iter.remove();
+ else if (logger != Logger.root)
+ {
+ logger.resetLogger();
+ logger.setLevel(null);
+ }
+ }
+ }
+
+ Logger.root.setLevel(Level.INFO);
+ Logger.root.resetLogger();
+ }
+
+ /**
+ * Configures the logging framework by reading a configuration file.
+ * The name and location of this file are specified by the system
+ * property <code>java.util.logging.config.file</code>. If this
+ * property is not set, the URL
+ * "{gnu.classpath.home.url}/logging.properties" is taken, where
+ * "{gnu.classpath.home.url}" stands for the value of the system
+ * property <code>gnu.classpath.home.url</code>.
+ *
+ * <p>The task of configuring the framework is then delegated to
+ * {@link #readConfiguration(java.io.InputStream)}, which will
+ * notify registered listeners after having read the properties.
+ *
+ * @throws SecurityException if a security manager exists and
+ * the caller is not granted the permission to control
+ * the logging infrastructure, or if the caller is
+ * not granted the permission to read the configuration
+ * file.
+ *
+ * @throws IOException if there is a problem reading in the
+ * configuration file.
+ */
+ public synchronized void readConfiguration()
+ throws IOException, SecurityException
+ {
+ String path;
+ InputStream inputStream;
+
+ path = System.getProperty("java.util.logging.config.file");
+ if ((path == null) || (path.length() == 0))
+ {
+ 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);
+ }
+ finally
+ {
+ // Close the stream in order to save
+ // resources such as file descriptors.
+ inputStream.close();
+ }
+ }
+
+ public synchronized void readConfiguration(InputStream inputStream)
+ throws IOException, SecurityException
+ {
+ Properties newProperties;
+ Enumeration keys;
+
+ checkAccess();
+ newProperties = new Properties();
+ newProperties.load(inputStream);
+ reset();
+ this.properties = newProperties;
+ keys = newProperties.propertyNames();
+
+ while (keys.hasMoreElements())
+ {
+ String key = ((String) keys.nextElement()).trim();
+ String value = newProperties.getProperty(key);
+
+ if (value == null)
+ continue;
+
+ value = value.trim();
+
+ if ("handlers".equals(key))
+ {
+ // In Java 5 and earlier this was specified to be
+ // whitespace-separated, but in reality it also accepted
+ // commas (tomcat relied on this), and in Java 6 the
+ // documentation was updated to fit the implementation.
+ StringTokenizer tokenizer = new StringTokenizer(value,
+ " \t\n\r\f,");
+ while (tokenizer.hasMoreTokens())
+ {
+ String handlerName = tokenizer.nextToken();
+ Handler handler = (Handler)
+ createInstance(handlerName, Handler.class, key);
+ // Tomcat also relies on the implementation ignoring
+ // items in 'handlers' which are not class names.
+ if (handler != null)
+ Logger.root.addHandler(handler);
+ }
+ }
+
+ if (key.endsWith(".level"))
+ {
+ String loggerName = key.substring(0, key.length() - 6);
+ Logger logger = getLogger(loggerName);
+
+ if (logger == null)
+ {
+ logger = Logger.getLogger(loggerName);
+ addLogger(logger);
+ }
+ Level level = null;
+ try
+ {
+ level = Level.parse(value);
+ }
+ catch (IllegalArgumentException e)
+ {
+ warn("bad level \'" + value + "\'", e);
+ }
+ if (level != null)
+ {
+ logger.setLevel(level);
+ }
+ continue;
+ }
+ }
+
+ /* The API specification does not talk about the
+ * property name that is distributed with the
+ * PropertyChangeEvent. With test code, it could
+ * be determined that the Sun J2SE 1.4 reference
+ * implementation uses null for the property name.
+ */
+ pcs.firePropertyChange(null, null, null);
+ }
+
+ /**
+ * Returns the value of a configuration property as a String.
+ */
+ public synchronized String getProperty(String name)
+ {
+ if (properties != null)
+ return properties.getProperty(name);
+ else
+ return null;
+ }
+
+ /**
+ * Returns the value of a configuration property as an integer.
+ * 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.
+ *
+ * @param defaultValue the value that will be returned if the
+ * property is not defined, or if its value is not an integer
+ * number.
+ */
+ static int getIntProperty(String name, int defaultValue)
+ {
+ try
+ {
+ return Integer.parseInt(getLogManager().getProperty(name));
+ }
+ catch (Exception ex)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Returns the value of a configuration property as an integer,
+ * provided it is inside the acceptable range.
+ * 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.
+ *
+ * @param minValue the lowest acceptable value.
+ *
+ * @param maxValue the highest acceptable value.
+ *
+ * @param defaultValue the value that will be returned if the
+ * property is not defined, or if its value is not an integer
+ * number, or if it is less than the minimum value,
+ * or if it is greater than the maximum value.
+ */
+ static int getIntPropertyClamped(String name, int defaultValue,
+ int minValue, int maxValue)
+ {
+ int val = getIntProperty(name, defaultValue);
+ if ((val < minValue) || (val > maxValue))
+ val = defaultValue;
+ return val;
+ }
+
+ /**
+ * Returns the value of a configuration property as a boolean.
+ * 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.
+ *
+ * @param defaultValue the value that will be returned if the
+ * property is not defined, or if its value is neither
+ * <code>"true"</code> nor <code>"false"</code>.
+ */
+ static boolean getBooleanProperty(String name, boolean defaultValue)
+ {
+ try
+ {
+ return (Boolean.valueOf(getLogManager().getProperty(name))).booleanValue();
+ }
+ catch (Exception ex)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Returns the value of a configuration property as a Level.
+ * 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 propertyName the name of the configuration property.
+ *
+ * @param defaultValue the value that will be returned if the
+ * property is not defined, or if
+ * {@link Level#parse(java.lang.String)} does not like
+ * the property value.
+ */
+ static Level getLevelProperty(String propertyName, Level defaultValue)
+ {
+ try
+ {
+ String value = getLogManager().getProperty(propertyName);
+ if (value != null)
+ return Level.parse(getLogManager().getProperty(propertyName));
+ else
+ return defaultValue;
+ }
+ catch (Exception ex)
+ {
+ return defaultValue;
+ }
+ }
+
+ /**
+ * Returns the value of a configuration property as a Class.
+ * 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 propertyName the name of the configuration property.
+ *
+ * @param defaultValue the value that will be returned if the
+ * property is not defined, or if it does not specify
+ * the name of a loadable class.
+ */
+ static final Class getClassProperty(String propertyName, Class defaultValue)
+ {
+ String propertyValue = logManager.getProperty(propertyName);
+
+ if (propertyValue != null)
+ try
+ {
+ return locateClass(propertyValue);
+ }
+ catch (ClassNotFoundException e)
+ {
+ warn(propertyName + " = " + propertyValue, e);
+ }
+
+ return defaultValue;
+ }
+
+ static final Object getInstanceProperty(String propertyName, Class ofClass,
+ Class defaultClass)
+ {
+ Class klass = getClassProperty(propertyName, defaultClass);
+ if (klass == null)
+ return null;
+
+ try
+ {
+ Object obj = klass.newInstance();
+ if (ofClass.isInstance(obj))
+ return obj;
+ }
+ catch (InstantiationException e)
+ {
+ warn(propertyName + " = " + klass.getName(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ warn(propertyName + " = " + klass.getName(), e);
+ }
+
+ if (defaultClass == null)
+ return null;
+
+ try
+ {
+ return defaultClass.newInstance();
+ }
+ catch (java.lang.InstantiationException ex)
+ {
+ throw new RuntimeException(ex.getMessage());
+ }
+ catch (java.lang.IllegalAccessException ex)
+ {
+ throw new RuntimeException(ex.getMessage());
+ }
+ }
+
+ /**
+ * An instance of <code>LoggingPermission("control")</code>
+ * that is shared between calls to <code>checkAccess()</code>.
+ */
+ private static final LoggingPermission controlPermission = new LoggingPermission("control",
+ null);
+
+ /**
+ * Checks whether the current security context allows changing
+ * the configuration of the logging framework. For the security
+ * context to be trusted, it has to be granted
+ * a LoggingPermission("control").
+ *
+ * @throws SecurityException if a security manager exists and
+ * the caller is not granted the permission to control
+ * the logging infrastructure.
+ */
+ public void checkAccess() throws SecurityException
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission(controlPermission);
+ }
+
+ /**
+ * Creates a new instance of a class specified by name and verifies
+ * that it is an instance (or subclass of) a given type.
+ *
+ * @param className the name of the class of which a new instance
+ * should be created.
+ *
+ * @param type the object created must be an instance of
+ * <code>type</code> or any subclass of <code>type</code>
+ *
+ * @param property the system property to reference in error
+ * messages
+ *
+ * @return the new instance, or <code>null</code> if
+ * <code>className</code> is <code>null</code>, if no class
+ * with that name could be found, if there was an error
+ * loading that class, or if the constructor of the class
+ * has thrown an exception.
+ */
+ private static final Object createInstance(String className, Class type,
+ String property)
+ {
+ Class klass = null;
+
+ if ((className == null) || (className.length() == 0))
+ return null;
+
+ try
+ {
+ klass = locateClass(className);
+ if (type.isAssignableFrom(klass))
+ return klass.newInstance();
+ warn(property, className, "not an instance of " + type.getName());
+ }
+ catch (ClassNotFoundException e)
+ {
+ warn(property, className, "class not found", e);
+ }
+ catch (IllegalAccessException e)
+ {
+ warn(property, className, "illegal access", e);
+ }
+ catch (InstantiationException e)
+ {
+ warn(property, className, e);
+ }
+ catch (java.lang.LinkageError e)
+ {
+ warn(property, className, "linkage error", e);
+ }
+
+ return null;
+ }
+
+ private static final void warn(String property, String klass, Throwable t)
+ {
+ warn(property, klass, null, t);
+ }
+
+ private static final void warn(String property, String klass, String msg)
+ {
+ warn(property, klass, msg, null);
+ }
+
+ private static final void warn(String property, String klass, String msg,
+ Throwable t)
+ {
+ warn("error instantiating '" + klass + "' referenced by " + property +
+ (msg == null ? "" : ", " + msg), t);
+ }
+
+ /**
+ * All debug warnings go through this method.
+ */
+
+ private static final void warn(String msg, Throwable t)
+ {
+ System.err.println("WARNING: " + msg);
+ if (t != null)
+ t.printStackTrace(System.err);
+ }
+
+ /**
+ * Locates a class by first checking the system class loader and
+ * then checking the context class loader.
+ *
+ * @param name the fully qualified name of the Class to locate
+ * @return Class the located Class
+ */
+
+ private static Class locateClass(String name) throws ClassNotFoundException
+ {
+ // GCJ LOCAL
+ // Unfortunately this can be called during bootstrap when
+ // Thread.currentThread() will return null.
+ // See bug #27658
+ Thread t = Thread.currentThread();
+ ClassLoader loader = (t == null) ? null : t.getContextClassLoader();
+ try
+ {
+ return Class.forName(name, true, loader);
+ }
+ catch (ClassNotFoundException e)
+ {
+ loader = ClassLoader.getSystemClassLoader();
+ return Class.forName(name, true, loader);
+ }
+ }
+
+ /**
+ * Return the logging bean. There is a single logging bean per
+ * VM instance.
+ * @since 1.5
+ */
+ public static synchronized LoggingMXBean getLoggingMXBean()
+ {
+ if (loggingBean == null)
+ {
+ loggingBean = new LoggingMXBean()
+ {
+ public String getLoggerLevel(String logger)
+ {
+ LogManager mgr = getLogManager();
+ Logger l = mgr.getLogger(logger);
+ if (l == null)
+ return null;
+ Level lev = l.getLevel();
+ if (lev == null)
+ return "";
+ return lev.getName();
+ }
+
+ public List getLoggerNames()
+ {
+ LogManager mgr = getLogManager();
+ // This is inefficient, but perhaps better for maintenance.
+ return Collections.list(mgr.getLoggerNames());
+ }
+
+ public String getParentLoggerName(String logger)
+ {
+ LogManager mgr = getLogManager();
+ Logger l = mgr.getLogger(logger);
+ if (l == null)
+ return null;
+ l = l.getParent();
+ if (l == null)
+ return "";
+ return l.getName();
+ }
+
+ public void setLoggerLevel(String logger, String level)
+ {
+ LogManager mgr = getLogManager();
+ Logger l = mgr.getLogger(logger);
+ if (l == null)
+ throw new IllegalArgumentException("no logger named " + logger);
+ Level newLevel;
+ if (level == null)
+ newLevel = null;
+ else
+ newLevel = Level.parse(level);
+ l.setLevel(newLevel);
+ }
+ };
+ }
+ return loggingBean;
+ }
+}
diff --git a/libjava/java/util/logging/LogRecord.h b/libjava/java/util/logging/LogRecord.h
new file mode 100644
index 000000000..445415909
--- /dev/null
+++ b/libjava/java/util/logging/LogRecord.h
@@ -0,0 +1,70 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_LogRecord__
+#define __java_util_logging_LogRecord__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::util::logging::LogRecord : public ::java::lang::Object
+{
+
+public:
+ LogRecord(::java::util::logging::Level *, ::java::lang::String *);
+private:
+ void readObject(::java::io::ObjectInputStream *);
+ void writeObject(::java::io::ObjectOutputStream *);
+public:
+ virtual ::java::lang::String * getLoggerName();
+ virtual void setLoggerName(::java::lang::String *);
+ virtual ::java::util::ResourceBundle * getResourceBundle();
+ virtual void setResourceBundle(::java::util::ResourceBundle *);
+ virtual ::java::lang::String * getResourceBundleName();
+ virtual void setResourceBundleName(::java::lang::String *);
+ virtual ::java::util::logging::Level * getLevel();
+ virtual void setLevel(::java::util::logging::Level *);
+private:
+ static jlong allocateSeqNum();
+public:
+ virtual jlong getSequenceNumber();
+ virtual void setSequenceNumber(jlong);
+ virtual ::java::lang::String * getSourceClassName();
+ virtual void setSourceClassName(::java::lang::String *);
+ virtual ::java::lang::String * getSourceMethodName();
+ virtual void setSourceMethodName(::java::lang::String *);
+ virtual ::java::lang::String * getMessage();
+ virtual void setMessage(::java::lang::String *);
+ virtual JArray< ::java::lang::Object * > * getParameters();
+ virtual void setParameters(JArray< ::java::lang::Object * > *);
+ virtual jint getThreadID();
+ virtual void setThreadID(jint);
+ virtual jlong getMillis();
+ virtual void setMillis(jlong);
+ virtual ::java::lang::Throwable * getThrown();
+ virtual void setThrown(::java::lang::Throwable *);
+private:
+ ::java::util::logging::Level * __attribute__((aligned(__alignof__( ::java::lang::Object)))) level;
+ jlong sequenceNumber;
+ ::java::lang::String * sourceClassName;
+ ::java::lang::String * sourceMethodName;
+ ::java::lang::String * message;
+ jint threadID;
+ jlong millis;
+ ::java::lang::Throwable * thrown;
+ ::java::lang::String * loggerName;
+ ::java::lang::String * resourceBundleName;
+ JArray< ::java::lang::Object * > * parameters;
+ ::java::util::ResourceBundle * bundle;
+public: // actually package-private
+ static const jlong serialVersionUID = 5372048053134512534LL;
+private:
+ static jlong lastSeqNum;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_LogRecord__
diff --git a/libjava/java/util/logging/Logger$1.h b/libjava/java/util/logging/Logger$1.h
new file mode 100644
index 000000000..69189e73b
--- /dev/null
+++ b/libjava/java/util/logging/Logger$1.h
@@ -0,0 +1,21 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_Logger$1__
+#define __java_util_logging_Logger$1__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::util::logging::Logger$1 : public ::java::lang::Object
+{
+
+public: // actually package-private
+ Logger$1();
+public:
+ virtual ::java::lang::Object * run();
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_Logger$1__
diff --git a/libjava/java/util/logging/Logger.h b/libjava/java/util/logging/Logger.h
new file mode 100644
index 000000000..c73a8d3c8
--- /dev/null
+++ b/libjava/java/util/logging/Logger.h
@@ -0,0 +1,90 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_Logger__
+#define __java_util_logging_Logger__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+
+class java::util::logging::Logger : public ::java::lang::Object
+{
+
+public: // actually protected
+ Logger(::java::lang::String *, ::java::lang::String *);
+public:
+ static ::java::util::logging::Logger * getLogger(::java::lang::String *);
+ static ::java::util::logging::Logger * getLogger(::java::lang::String *, ::java::lang::String *);
+ static ::java::util::logging::Logger * getAnonymousLogger();
+ static ::java::util::logging::Logger * getAnonymousLogger(::java::lang::String *);
+ virtual ::java::lang::String * getResourceBundleName();
+ virtual ::java::util::ResourceBundle * getResourceBundle();
+ virtual ::java::util::logging::Level * getLevel();
+ virtual jboolean isLoggable(::java::util::logging::Level *);
+ virtual void setLevel(::java::util::logging::Level *);
+ virtual ::java::util::logging::Filter * getFilter();
+ virtual void setFilter(::java::util::logging::Filter *);
+ virtual ::java::lang::String * getName();
+ virtual void log(::java::util::logging::LogRecord *);
+ virtual void log(::java::util::logging::Level *, ::java::lang::String *);
+ virtual void log(::java::util::logging::Level *, ::java::lang::String *, ::java::lang::Object *);
+ virtual void log(::java::util::logging::Level *, ::java::lang::String *, JArray< ::java::lang::Object * > *);
+ virtual void log(::java::util::logging::Level *, ::java::lang::String *, ::java::lang::Throwable *);
+ virtual void logp(::java::util::logging::Level *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ virtual void logp(::java::util::logging::Level *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::Object *);
+private:
+ ::java::util::ResourceBundle * findResourceBundle();
+ void logImpl(::java::util::logging::Level *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, JArray< ::java::lang::Object * > *);
+public:
+ virtual void logp(::java::util::logging::Level *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, JArray< ::java::lang::Object * > *);
+ virtual void logp(::java::util::logging::Level *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::Throwable *);
+ virtual void logrb(::java::util::logging::Level *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ virtual void logrb(::java::util::logging::Level *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::Object *);
+ virtual void logrb(::java::util::logging::Level *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, JArray< ::java::lang::Object * > *);
+ virtual void logrb(::java::util::logging::Level *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::Throwable *);
+ virtual void entering(::java::lang::String *, ::java::lang::String *);
+ virtual void entering(::java::lang::String *, ::java::lang::String *, ::java::lang::Object *);
+ virtual void entering(::java::lang::String *, ::java::lang::String *, JArray< ::java::lang::Object * > *);
+ virtual void exiting(::java::lang::String *, ::java::lang::String *);
+ virtual void exiting(::java::lang::String *, ::java::lang::String *, ::java::lang::Object *);
+ virtual void throwing(::java::lang::String *, ::java::lang::String *, ::java::lang::Throwable *);
+ virtual void severe(::java::lang::String *);
+ virtual void warning(::java::lang::String *);
+ virtual void info(::java::lang::String *);
+ virtual void config(::java::lang::String *);
+ virtual void fine(::java::lang::String *);
+ virtual void finer(::java::lang::String *);
+ virtual void finest(::java::lang::String *);
+ virtual void addHandler(::java::util::logging::Handler *);
+ virtual void removeHandler(::java::util::logging::Handler *);
+ virtual JArray< ::java::util::logging::Handler * > * getHandlers();
+ virtual jboolean getUseParentHandlers();
+ virtual void setUseParentHandlers(jboolean);
+ virtual ::java::util::logging::Logger * getParent();
+ virtual void setParent(::java::util::logging::Logger *);
+private:
+ ::java::lang::StackTraceElement * getCallerStackFrame();
+public: // actually package-private
+ virtual void resetLogger();
+ static ::java::util::logging::Logger * root;
+public:
+ static ::java::util::logging::Logger * global;
+private:
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) name;
+ ::java::lang::String * resourceBundleName;
+ ::java::util::ResourceBundle * resourceBundle;
+ ::java::util::logging::Filter * filter;
+ ::java::util::List * handlerList;
+ JArray< ::java::util::logging::Handler * > * handlers;
+ jboolean anonymous;
+ jboolean useParentHandlers;
+ ::java::util::logging::Level * level;
+ ::java::util::logging::Logger * parent;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_Logger__
diff --git a/libjava/java/util/logging/Logger.java b/libjava/java/util/logging/Logger.java
new file mode 100644
index 000000000..04f24d354
--- /dev/null
+++ b/libjava/java/util/logging/Logger.java
@@ -0,0 +1,1206 @@
+/* Logger.java -- a class for logging messages
+ Copyright (C) 2002, 2004, 2006, 2007 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util.logging;
+
+import java.util.List;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * A Logger is used for logging information about events. Usually, there
+ * is a seprate logger for each subsystem or component, although there
+ * is a shared instance for components that make only occasional use of
+ * the logging framework.
+ *
+ * <p>It is common to name a logger after the name of a corresponding
+ * Java package. Loggers are organized into a hierarchical namespace;
+ * for example, the logger <code>"org.gnu.foo"</code> is the
+ * <em>parent</em> of logger <code>"org.gnu.foo.bar"</code>.
+ *
+ * <p>A logger for a named subsystem can be obtained through {@link
+ * java.util.logging.Logger#getLogger(java.lang.String)}. However,
+ * only code which has been granted the permission to control the
+ * logging infrastructure will be allowed to customize that logger.
+ * Untrusted code can obtain a private, anonymous logger through
+ * {@link #getAnonymousLogger()} if it wants to perform any
+ * modifications to the logger.
+ *
+ * <p>FIXME: Write more documentation.
+ *
+ * @author Sascha Brawer (brawer@acm.org)
+ */
+public class Logger
+{
+
+ static final Logger root = new Logger("", null);
+
+ /**
+ * A logger provided to applications that make only occasional use
+ * of the logging framework, typically early prototypes. Serious
+ * products are supposed to create and use their own Loggers, so
+ * they can be controlled individually.
+ */
+ public static final Logger global;
+
+ static
+ {
+ // Our class might be initialized from an unprivileged context
+ global = (Logger) AccessController.doPrivileged
+ (new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return getLogger("global");
+ }
+ });
+ }
+
+
+ /**
+ * The name of the Logger, or <code>null</code> if the logger is
+ * anonymous.
+ *
+ * <p>A previous version of the GNU Classpath implementation granted
+ * untrusted code the permission to control any logger whose name
+ * was null. However, test code revealed that the Sun J2SE 1.4
+ * reference implementation enforces the security control for any
+ * logger that was not created through getAnonymousLogger, even if
+ * it has a null name. Therefore, a separate flag {@link
+ * Logger#anonymous} was introduced.
+ */
+ private final String name;
+
+
+ /**
+ * The name of the resource bundle used for localization.
+ *
+ * <p>This variable cannot be declared as <code>final</code>
+ * because its value can change as a result of calling
+ * getLogger(String,String).
+ */
+ private String resourceBundleName;
+
+
+ /**
+ * The resource bundle used for localization.
+ *
+ * <p>This variable cannot be declared as <code>final</code>
+ * because its value can change as a result of calling
+ * getLogger(String,String).
+ */
+ private ResourceBundle resourceBundle;
+
+ private Filter filter;
+
+ private final List handlerList = new java.util.ArrayList(4);
+ private Handler[] handlers = new Handler[0];
+
+ /**
+ * Indicates whether or not this logger is anonymous. While
+ * a LoggingPermission is required for any modifications to
+ * a normal logger, untrusted code can obtain an anonymous logger
+ * and modify it according to its needs.
+ *
+ * <p>A previous version of the GNU Classpath implementation
+ * granted access to every logger whose name was null.
+ * However, test code revealed that the Sun J2SE 1.4 reference
+ * implementation enforces the security control for any logger
+ * that was not created through getAnonymousLogger, even
+ * if it has a null name.
+ */
+ private boolean anonymous;
+
+
+ private boolean useParentHandlers;
+
+ private Level level;
+
+ private Logger parent;
+
+ /**
+ * Constructs a Logger for a subsystem. Most applications do not
+ * need to create new Loggers explicitly; instead, they should call
+ * the static factory methods
+ * {@link #getLogger(java.lang.String,java.lang.String) getLogger}
+ * (with ResourceBundle for localization) or
+ * {@link #getLogger(java.lang.String) getLogger} (without
+ * ResourceBundle), respectively.
+ *
+ * @param name the name for the logger, for example "java.awt"
+ * or "com.foo.bar". The name should be based on
+ * the name of the package issuing log records
+ * and consist of dot-separated Java identifiers.
+ *
+ * @param resourceBundleName the name of a resource bundle
+ * for localizing messages, or <code>null</code>
+ * to indicate that messages do not need to be localized.
+ *
+ * @throws java.util.MissingResourceException if
+ * <code>resourceBundleName</code> is not <code>null</code>
+ * and no such bundle could be located.
+ */
+ protected Logger(String name, String resourceBundleName)
+ throws MissingResourceException
+ {
+ this.name = name;
+ this.resourceBundleName = resourceBundleName;
+
+ if (resourceBundleName == null)
+ resourceBundle = null;
+ else
+ resourceBundle = ResourceBundle.getBundle(resourceBundleName);
+
+ level = null;
+
+ /* This is null when the root logger is being constructed,
+ * and the root logger afterwards.
+ */
+ parent = root;
+
+ useParentHandlers = (parent != null);
+ }
+
+
+
+ /**
+ * Finds a registered logger for a subsystem, or creates one in
+ * case no logger has been registered yet.
+ *
+ * @param name the name for the logger, for example "java.awt"
+ * or "com.foo.bar". The name should be based on
+ * the name of the package issuing log records
+ * and consist of dot-separated Java identifiers.
+ *
+ * @throws IllegalArgumentException if a logger for the subsystem
+ * identified by <code>name</code> has already been created,
+ * but uses a a resource bundle for localizing messages.
+ *
+ * @throws NullPointerException if <code>name</code> is
+ * <code>null</code>.
+ *
+ * @return a logger for the subsystem specified by <code>name</code>
+ * that does not localize messages.
+ */
+ public static Logger getLogger(String name)
+ {
+ return getLogger(name, null);
+ }
+
+
+ /**
+ * Finds a registered logger for a subsystem, or creates one in case
+ * no logger has been registered yet.
+ *
+ * <p>If a logger with the specified name has already been
+ * registered, the behavior depends on the resource bundle that is
+ * currently associated with the existing logger.
+ *
+ * <ul><li>If the existing logger uses the same resource bundle as
+ * specified by <code>resourceBundleName</code>, the existing logger
+ * is returned.</li>
+ *
+ * <li>If the existing logger currently does not localize messages,
+ * the existing logger is modified to use the bundle specified by
+ * <code>resourceBundleName</code>. The existing logger is then
+ * returned. Therefore, all subsystems currently using this logger
+ * will produce localized messages from now on.</li>
+ *
+ * <li>If the existing logger already has an associated resource
+ * bundle, but a different one than specified by
+ * <code>resourceBundleName</code>, an
+ * <code>IllegalArgumentException</code> is thrown.</li></ul>
+ *
+ * @param name the name for the logger, for example "java.awt"
+ * or "org.gnu.foo". The name should be based on
+ * the name of the package issuing log records
+ * and consist of dot-separated Java identifiers.
+ *
+ * @param resourceBundleName the name of a resource bundle
+ * for localizing messages, or <code>null</code>
+ * to indicate that messages do not need to be localized.
+ *
+ * @return a logger for the subsystem specified by <code>name</code>.
+ *
+ * @throws java.util.MissingResourceException if
+ * <code>resourceBundleName</code> is not <code>null</code>
+ * and no such bundle could be located.
+ *
+ * @throws IllegalArgumentException if a logger for the subsystem
+ * identified by <code>name</code> has already been created,
+ * but uses a different resource bundle for localizing
+ * messages.
+ *
+ * @throws NullPointerException if <code>name</code> is
+ * <code>null</code>.
+ */
+ public static Logger getLogger(String name, String resourceBundleName)
+ {
+ LogManager lm = LogManager.getLogManager();
+ Logger result;
+
+ if (name == null)
+ throw new NullPointerException();
+
+ /* Without synchronized(lm), it could happen that another thread
+ * would create a logger between our calls to getLogger and
+ * addLogger. While addLogger would indicate this by returning
+ * false, we could not be sure that this other logger was still
+ * existing when we called getLogger a second time in order
+ * to retrieve it -- note that LogManager is only allowed to
+ * keep weak references to registered loggers, so Loggers
+ * can be garbage collected at any time in general, and between
+ * our call to addLogger and our second call go getLogger
+ * in particular.
+ *
+ * Of course, we assume here that LogManager.addLogger etc.
+ * are synchronizing on the global LogManager object. There
+ * is a comment in the implementation of LogManager.addLogger
+ * referring to this comment here, so that any change in
+ * the synchronization of LogManager will be reflected here.
+ */
+ synchronized (lm)
+ {
+ result = lm.getLogger(name);
+ if (result == null)
+ {
+ boolean couldBeAdded;
+
+ result = new Logger(name, resourceBundleName);
+ couldBeAdded = lm.addLogger(result);
+ if (!couldBeAdded)
+ throw new IllegalStateException("cannot register new logger");
+ }
+ else
+ {
+ /* The logger already exists. Make sure it uses
+ * the same resource bundle for localizing messages.
+ */
+ String existingBundleName = result.getResourceBundleName();
+
+ /* The Sun J2SE 1.4 reference implementation will return the
+ * registered logger object, even if it does not have a resource
+ * bundle associated with it. However, it seems to change the
+ * resourceBundle of the registered logger to the bundle
+ * whose name was passed to getLogger.
+ */
+ if ((existingBundleName == null) && (resourceBundleName != null))
+ {
+ /* If ResourceBundle.getBundle throws an exception, the
+ * existing logger will be unchanged. This would be
+ * different if the assignment to resourceBundleName
+ * came first.
+ */
+ result.resourceBundle = ResourceBundle.getBundle(resourceBundleName);
+ result.resourceBundleName = resourceBundleName;
+ return result;
+ }
+
+ if ((existingBundleName != resourceBundleName)
+ && ((existingBundleName == null)
+ || !existingBundleName.equals(resourceBundleName)))
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ return result;
+ }
+
+
+ /**
+ * Creates a new, unnamed logger. Unnamed loggers are not
+ * registered in the namespace of the LogManager, and no special
+ * security permission is required for changing their state.
+ * Therefore, untrusted applets are able to modify their private
+ * logger instance obtained through this method.
+ *
+ * <p>The parent of the newly created logger will the the root
+ * logger, from which the level threshold and the handlers are
+ * inherited.
+ */
+ public static Logger getAnonymousLogger()
+ {
+ return getAnonymousLogger(null);
+ }
+
+
+ /**
+ * Creates a new, unnamed logger. Unnamed loggers are not
+ * registered in the namespace of the LogManager, and no special
+ * security permission is required for changing their state.
+ * Therefore, untrusted applets are able to modify their private
+ * logger instance obtained through this method.
+ *
+ * <p>The parent of the newly created logger will the the root
+ * logger, from which the level threshold and the handlers are
+ * inherited.
+ *
+ * @param resourceBundleName the name of a resource bundle
+ * for localizing messages, or <code>null</code>
+ * to indicate that messages do not need to be localized.
+ *
+ * @throws java.util.MissingResourceException if
+ * <code>resourceBundleName</code> is not <code>null</code>
+ * and no such bundle could be located.
+ */
+ public static Logger getAnonymousLogger(String resourceBundleName)
+ throws MissingResourceException
+ {
+ Logger result;
+
+ result = new Logger(null, resourceBundleName);
+ result.anonymous = true;
+ return result;
+ }
+
+
+ /**
+ * Returns the name of the resource bundle that is being used for
+ * localizing messages.
+ *
+ * @return the name of the resource bundle used for localizing messages,
+ * or <code>null</code> if the parent's resource bundle
+ * is used for this purpose.
+ */
+ public synchronized String getResourceBundleName()
+ {
+ return resourceBundleName;
+ }
+
+
+ /**
+ * Returns the resource bundle that is being used for localizing
+ * messages.
+ *
+ * @return the resource bundle used for localizing messages,
+ * or <code>null</code> if the parent's resource bundle
+ * is used for this purpose.
+ */
+ public synchronized ResourceBundle getResourceBundle()
+ {
+ return resourceBundle;
+ }
+
+
+ /**
+ * Returns the severity level threshold for this <code>Handler</code>.
+ * All log records with a lower severity level will be discarded;
+ * a log record of the same or a higher level will be published
+ * unless an installed <code>Filter</code> decides to discard it.
+ *
+ * @return the severity level below which all log messages will be
+ * discarded, or <code>null</code> if the logger inherits
+ * the threshold from its parent.
+ */
+ public synchronized Level getLevel()
+ {
+ return level;
+ }
+
+
+ /**
+ * Returns whether or not a message of the specified level
+ * would be logged by this logger.
+ *
+ * @throws NullPointerException if <code>level</code>
+ * is <code>null</code>.
+ */
+ public synchronized boolean isLoggable(Level level)
+ {
+ if (this.level != null)
+ return this.level.intValue() <= level.intValue();
+
+ if (parent != null)
+ return parent.isLoggable(level);
+ else
+ return false;
+ }
+
+
+ /**
+ * Sets the severity level threshold for this <code>Handler</code>.
+ * All log records with a lower severity level will be discarded
+ * immediately. A log record of the same or a higher level will be
+ * published unless an installed <code>Filter</code> decides to
+ * discard it.
+ *
+ * @param level the severity level below which all log messages
+ * will be discarded, or <code>null</code> to
+ * indicate that the logger should inherit the
+ * threshold from its parent.
+ *
+ * @throws SecurityException if this logger is not anonymous, a
+ * security manager exists, and the caller is not granted
+ * the permission to control the logging infrastructure by
+ * having LoggingPermission("control"). Untrusted code can
+ * obtain an anonymous logger through the static factory method
+ * {@link #getAnonymousLogger(java.lang.String) getAnonymousLogger}.
+ */
+ public synchronized void setLevel(Level level)
+ {
+ /* An application is allowed to control an anonymous logger
+ * without having the permission to control the logging
+ * infrastructure.
+ */
+ if (!anonymous)
+ LogManager.getLogManager().checkAccess();
+
+ this.level = level;
+ }
+
+
+ public synchronized Filter getFilter()
+ {
+ return filter;
+ }
+
+
+ /**
+ * @throws SecurityException if this logger is not anonymous, a
+ * security manager exists, and the caller is not granted
+ * the permission to control the logging infrastructure by
+ * having LoggingPermission("control"). Untrusted code can
+ * obtain an anonymous logger through the static factory method
+ * {@link #getAnonymousLogger(java.lang.String) getAnonymousLogger}.
+ */
+ public synchronized void setFilter(Filter filter)
+ throws SecurityException
+ {
+ /* An application is allowed to control an anonymous logger
+ * without having the permission to control the logging
+ * infrastructure.
+ */
+ if (!anonymous)
+ LogManager.getLogManager().checkAccess();
+
+ this.filter = filter;
+ }
+
+
+
+
+ /**
+ * Returns the name of this logger.
+ *
+ * @return the name of this logger, or <code>null</code> if
+ * the logger is anonymous.
+ */
+ public String getName()
+ {
+ /* Note that the name of a logger cannot be changed during
+ * its lifetime, so no synchronization is needed.
+ */
+ return name;
+ }
+
+
+ /**
+ * Passes a record to registered handlers, provided the record
+ * is considered as loggable both by {@link #isLoggable(Level)}
+ * and a possibly installed custom {@link #setFilter(Filter) filter}.
+ *
+ * <p>If the logger has been configured to use parent handlers,
+ * the record will be forwarded to the parent of this logger
+ * in addition to being processed by the handlers registered with
+ * this logger.
+ *
+ * <p>The other logging methods in this class are convenience methods
+ * that merely create a new LogRecord and pass it to this method.
+ * Therefore, subclasses usually just need to override this single
+ * method for customizing the logging behavior.
+ *
+ * @param record the log record to be inspected and possibly forwarded.
+ */
+ public synchronized void log(LogRecord record)
+ {
+ if (!isLoggable(record.getLevel()))
+ return;
+
+ if ((filter != null) && !filter.isLoggable(record))
+ return;
+
+ /* If no logger name has been set for the log record,
+ * use the name of this logger.
+ */
+ if (record.getLoggerName() == null)
+ record.setLoggerName(name);
+
+ /* Avoid that some other thread is changing the logger hierarchy
+ * while we are traversing it.
+ */
+ synchronized (LogManager.getLogManager())
+ {
+ Logger curLogger = this;
+
+ do
+ {
+ /* The Sun J2SE 1.4 reference implementation seems to call the
+ * filter only for the logger whose log method is called,
+ * never for any of its parents. Also, parent loggers publish
+ * log record whatever their level might be. This is pretty
+ * weird, but GNU Classpath tries to be as compatible as
+ * possible to the reference implementation.
+ */
+ for (int i = 0; i < curLogger.handlers.length; i++)
+ curLogger.handlers[i].publish(record);
+
+ if (curLogger.getUseParentHandlers() == false)
+ break;
+
+ curLogger = curLogger.getParent();
+ }
+ while (parent != null);
+ }
+ }
+
+
+ public void log(Level level, String message)
+ {
+ if (isLoggable(level))
+ log(level, message, (Object[]) null);
+ }
+
+
+ public synchronized void log(Level level,
+ String message,
+ Object param)
+ {
+ if (isLoggable(level))
+ {
+ StackTraceElement caller = getCallerStackFrame();
+ logp(level,
+ caller != null ? caller.getClassName() : "<unknown>",
+ caller != null ? caller.getMethodName() : "<unknown>",
+ message,
+ param);
+ }
+ }
+
+
+ public synchronized void log(Level level,
+ String message,
+ Object[] params)
+ {
+ if (isLoggable(level))
+ {
+ StackTraceElement caller = getCallerStackFrame();
+ logp(level,
+ caller != null ? caller.getClassName() : "<unknown>",
+ caller != null ? caller.getMethodName() : "<unknown>",
+ message,
+ params);
+ }
+ }
+
+
+ public synchronized void log(Level level,
+ String message,
+ Throwable thrown)
+ {
+ if (isLoggable(level))
+ {
+ StackTraceElement caller = getCallerStackFrame();
+ logp(level,
+ caller != null ? caller.getClassName() : "<unknown>",
+ caller != null ? caller.getMethodName() : "<unknown>",
+ message,
+ thrown);
+ }
+ }
+
+
+ public synchronized void logp(Level level,
+ String sourceClass,
+ String sourceMethod,
+ String message)
+ {
+ logp(level, sourceClass, sourceMethod, message,
+ (Object[]) null);
+ }
+
+
+ public synchronized void logp(Level level,
+ String sourceClass,
+ String sourceMethod,
+ String message,
+ Object param)
+ {
+ logp(level, sourceClass, sourceMethod, message,
+ new Object[] { param });
+ }
+
+
+ private synchronized ResourceBundle findResourceBundle()
+ {
+ if (resourceBundle != null)
+ return resourceBundle;
+
+ if (parent != null)
+ return parent.findResourceBundle();
+
+ return null;
+ }
+
+
+ private synchronized void logImpl(Level level,
+ String sourceClass,
+ String sourceMethod,
+ String message,
+ Object[] params)
+ {
+ LogRecord rec = new LogRecord(level, message);
+
+ rec.setResourceBundle(findResourceBundle());
+ rec.setSourceClassName(sourceClass);
+ rec.setSourceMethodName(sourceMethod);
+ rec.setParameters(params);
+
+ log(rec);
+ }
+
+
+ public synchronized void logp(Level level,
+ String sourceClass,
+ String sourceMethod,
+ String message,
+ Object[] params)
+ {
+ logImpl(level, sourceClass, sourceMethod, message, params);
+ }
+
+
+ public synchronized void logp(Level level,
+ String sourceClass,
+ String sourceMethod,
+ String message,
+ Throwable thrown)
+ {
+ LogRecord rec = new LogRecord(level, message);
+
+ rec.setResourceBundle(resourceBundle);
+ rec.setSourceClassName(sourceClass);
+ rec.setSourceMethodName(sourceMethod);
+ rec.setThrown(thrown);
+
+ log(rec);
+ }
+
+
+ public synchronized void logrb(Level level,
+ String sourceClass,
+ String sourceMethod,
+ String bundleName,
+ String message)
+ {
+ logrb(level, sourceClass, sourceMethod, bundleName,
+ message, (Object[]) null);
+ }
+
+
+ public synchronized void logrb(Level level,
+ String sourceClass,
+ String sourceMethod,
+ String bundleName,
+ String message,
+ Object param)
+ {
+ logrb(level, sourceClass, sourceMethod, bundleName,
+ message, new Object[] { param });
+ }
+
+
+ public synchronized void logrb(Level level,
+ String sourceClass,
+ String sourceMethod,
+ String bundleName,
+ String message,
+ Object[] params)
+ {
+ LogRecord rec = new LogRecord(level, message);
+
+ rec.setResourceBundleName(bundleName);
+ rec.setSourceClassName(sourceClass);
+ rec.setSourceMethodName(sourceMethod);
+ rec.setParameters(params);
+
+ log(rec);
+ }
+
+
+ public synchronized void logrb(Level level,
+ String sourceClass,
+ String sourceMethod,
+ String bundleName,
+ String message,
+ Throwable thrown)
+ {
+ LogRecord rec = new LogRecord(level, message);
+
+ rec.setResourceBundleName(bundleName);
+ rec.setSourceClassName(sourceClass);
+ rec.setSourceMethodName(sourceMethod);
+ rec.setThrown(thrown);
+
+ log(rec);
+ }
+
+
+ public synchronized void entering(String sourceClass,
+ String sourceMethod)
+ {
+ if (isLoggable(Level.FINER))
+ logp(Level.FINER, sourceClass, sourceMethod, "ENTRY");
+ }
+
+
+ public synchronized void entering(String sourceClass,
+ String sourceMethod,
+ Object param)
+ {
+ if (isLoggable(Level.FINER))
+ logp(Level.FINER, sourceClass, sourceMethod, "ENTRY {0}", param);
+ }
+
+
+ public synchronized void entering(String sourceClass,
+ String sourceMethod,
+ Object[] params)
+ {
+ if (isLoggable(Level.FINER))
+ {
+ StringBuffer buf = new StringBuffer(80);
+ buf.append("ENTRY");
+ for (int i = 0; i < params.length; i++)
+ {
+ buf.append(" {");
+ buf.append(i);
+ buf.append('}');
+ }
+
+ logp(Level.FINER, sourceClass, sourceMethod, buf.toString(), params);
+ }
+ }
+
+
+ public synchronized void exiting(String sourceClass,
+ String sourceMethod)
+ {
+ if (isLoggable(Level.FINER))
+ logp(Level.FINER, sourceClass, sourceMethod, "RETURN");
+ }
+
+
+ public synchronized void exiting(String sourceClass,
+ String sourceMethod,
+ Object result)
+ {
+ if (isLoggable(Level.FINER))
+ logp(Level.FINER, sourceClass, sourceMethod, "RETURN {0}", result);
+ }
+
+
+ public synchronized void throwing(String sourceClass,
+ String sourceMethod,
+ Throwable thrown)
+ {
+ if (isLoggable(Level.FINER))
+ logp(Level.FINER, sourceClass, sourceMethod, "THROW", thrown);
+ }
+
+
+ /**
+ * Logs a message with severity level SEVERE, indicating a serious
+ * failure that prevents normal program execution. Messages at this
+ * level should be understandable to an inexperienced, non-technical
+ * end user. Ideally, they explain in simple words what actions the
+ * user can take in order to resolve the problem.
+ *
+ * @see Level#SEVERE
+ *
+ * @param message the message text, also used as look-up key if the
+ * logger is localizing messages with a resource
+ * bundle. While it is possible to pass
+ * <code>null</code>, this is not recommended, since
+ * a logging message without text is unlikely to be
+ * helpful.
+ */
+ public synchronized void severe(String message)
+ {
+ if (isLoggable(Level.SEVERE))
+ log(Level.SEVERE, message);
+ }
+
+
+ /**
+ * Logs a message with severity level WARNING, indicating a
+ * potential problem that does not prevent normal program execution.
+ * Messages at this level should be understandable to an
+ * inexperienced, non-technical end user. Ideally, they explain in
+ * simple words what actions the user can take in order to resolve
+ * the problem.
+ *
+ * @see Level#WARNING
+ *
+ * @param message the message text, also used as look-up key if the
+ * logger is localizing messages with a resource
+ * bundle. While it is possible to pass
+ * <code>null</code>, this is not recommended, since
+ * a logging message without text is unlikely to be
+ * helpful.
+ */
+ public synchronized void warning(String message)
+ {
+ if (isLoggable(Level.WARNING))
+ log(Level.WARNING, message);
+ }
+
+
+ /**
+ * Logs a message with severity level INFO. {@link Level#INFO} is
+ * intended for purely informational messages that do not indicate
+ * error or warning situations. In the default logging
+ * configuration, INFO messages will be written to the system
+ * console. For this reason, the INFO level should be used only for
+ * messages that are important to end users and system
+ * administrators. Messages at this level should be understandable
+ * to an inexperienced, non-technical user.
+ *
+ * @param message the message text, also used as look-up key if the
+ * logger is localizing messages with a resource
+ * bundle. While it is possible to pass
+ * <code>null</code>, this is not recommended, since
+ * a logging message without text is unlikely to be
+ * helpful.
+ */
+ public synchronized void info(String message)
+ {
+ if (isLoggable(Level.INFO))
+ log(Level.INFO, message);
+ }
+
+
+ /**
+ * Logs a message with severity level CONFIG. {@link Level#CONFIG} is
+ * intended for static configuration messages, for example about the
+ * windowing environment, the operating system version, etc.
+ *
+ * @param message the message text, also used as look-up key if the
+ * logger is localizing messages with a resource bundle. While
+ * it is possible to pass <code>null</code>, this is not
+ * recommended, since a logging message without text is unlikely
+ * to be helpful.
+ */
+ public synchronized void config(String message)
+ {
+ if (isLoggable(Level.CONFIG))
+ log(Level.CONFIG, message);
+ }
+
+
+ /**
+ * Logs a message with severity level FINE. {@link Level#FINE} is
+ * intended for messages that are relevant for developers using
+ * the component generating log messages. Examples include minor,
+ * recoverable failures, or possible inefficiencies.
+ *
+ * @param message the message text, also used as look-up key if the
+ * logger is localizing messages with a resource
+ * bundle. While it is possible to pass
+ * <code>null</code>, this is not recommended, since
+ * a logging message without text is unlikely to be
+ * helpful.
+ */
+ public synchronized void fine(String message)
+ {
+ if (isLoggable(Level.FINE))
+ log(Level.FINE, message);
+ }
+
+
+ /**
+ * Logs a message with severity level FINER. {@link Level#FINER} is
+ * intended for rather detailed tracing, for example entering a
+ * method, returning from a method, or throwing an exception.
+ *
+ * @param message the message text, also used as look-up key if the
+ * logger is localizing messages with a resource
+ * bundle. While it is possible to pass
+ * <code>null</code>, this is not recommended, since
+ * a logging message without text is unlikely to be
+ * helpful.
+ */
+ public synchronized void finer(String message)
+ {
+ if (isLoggable(Level.FINER))
+ log(Level.FINER, message);
+ }
+
+
+ /**
+ * Logs a message with severity level FINEST. {@link Level#FINEST}
+ * is intended for highly detailed tracing, for example reaching a
+ * certain point inside the body of a method.
+ *
+ * @param message the message text, also used as look-up key if the
+ * logger is localizing messages with a resource
+ * bundle. While it is possible to pass
+ * <code>null</code>, this is not recommended, since
+ * a logging message without text is unlikely to be
+ * helpful.
+ */
+ public synchronized void finest(String message)
+ {
+ if (isLoggable(Level.FINEST))
+ log(Level.FINEST, message);
+ }
+
+
+ /**
+ * Adds a handler to the set of handlers that get notified
+ * when a log record is to be published.
+ *
+ * @param handler the handler to be added.
+ *
+ * @throws NullPointerException if <code>handler</code>
+ * is <code>null</code>.
+ *
+ * @throws SecurityException if this logger is not anonymous, a
+ * security manager exists, and the caller is not granted
+ * the permission to control the logging infrastructure by
+ * having LoggingPermission("control"). Untrusted code can
+ * obtain an anonymous logger through the static factory method
+ * {@link #getAnonymousLogger(java.lang.String) getAnonymousLogger}.
+ */
+ public synchronized void addHandler(Handler handler)
+ throws SecurityException
+ {
+ if (handler == null)
+ throw new NullPointerException();
+
+ /* An application is allowed to control an anonymous logger
+ * without having the permission to control the logging
+ * infrastructure.
+ */
+ if (!anonymous)
+ LogManager.getLogManager().checkAccess();
+
+ if (!handlerList.contains(handler))
+ {
+ handlerList.add(handler);
+ handlers = getHandlers();
+ }
+ }
+
+
+ /**
+ * Removes a handler from the set of handlers that get notified
+ * when a log record is to be published.
+ *
+ * @param handler the handler to be removed.
+ *
+ * @throws SecurityException if this logger is not anonymous, a
+ * security manager exists, and the caller is not granted the
+ * permission to control the logging infrastructure by having
+ * LoggingPermission("control"). Untrusted code can obtain an
+ * anonymous logger through the static factory method {@link
+ * #getAnonymousLogger(java.lang.String) getAnonymousLogger}.
+ *
+ * @throws NullPointerException if <code>handler</code>
+ * is <code>null</code>.
+ */
+ public synchronized void removeHandler(Handler handler)
+ throws SecurityException
+ {
+ /* An application is allowed to control an anonymous logger
+ * without having the permission to control the logging
+ * infrastructure.
+ */
+ if (!anonymous)
+ LogManager.getLogManager().checkAccess();
+
+ if (handler == null)
+ throw new NullPointerException();
+
+ handlerList.remove(handler);
+ handlers = getHandlers();
+ }
+
+
+ /**
+ * Returns the handlers currently registered for this Logger.
+ * When a log record has been deemed as being loggable,
+ * it will be passed to all registered handlers for
+ * publication. In addition, if the logger uses parent handlers
+ * (see {@link #getUseParentHandlers() getUseParentHandlers}
+ * and {@link #setUseParentHandlers(boolean) setUseParentHandlers},
+ * the log record will be passed to the parent's handlers.
+ */
+ public synchronized Handler[] getHandlers()
+ {
+ /* We cannot return our internal handlers array
+ * because we do not have any guarantee that the
+ * caller would not change the array entries.
+ */
+ return (Handler[]) handlerList.toArray(new Handler[handlerList.size()]);
+ }
+
+
+ /**
+ * Returns whether or not this Logger forwards log records to
+ * handlers registered for its parent loggers.
+ *
+ * @return <code>false</code> if this Logger sends log records
+ * merely to Handlers registered with itself;
+ * <code>true</code> if this Logger sends log records
+ * not only to Handlers registered with itself, but also
+ * to those Handlers registered with parent loggers.
+ */
+ public synchronized boolean getUseParentHandlers()
+ {
+ return useParentHandlers;
+ }
+
+
+ /**
+ * Sets whether or not this Logger forwards log records to
+ * handlers registered for its parent loggers.
+ *
+ * @param useParentHandlers <code>false</code> to let this
+ * Logger send log records merely to Handlers registered
+ * with itself; <code>true</code> to let this Logger
+ * send log records not only to Handlers registered
+ * with itself, but also to those Handlers registered with
+ * parent loggers.
+ *
+ * @throws SecurityException if this logger is not anonymous, a
+ * security manager exists, and the caller is not granted
+ * the permission to control the logging infrastructure by
+ * having LoggingPermission("control"). Untrusted code can
+ * obtain an anonymous logger through the static factory method
+ * {@link #getAnonymousLogger(java.lang.String) getAnonymousLogger}.
+ *
+ */
+ public synchronized void setUseParentHandlers(boolean useParentHandlers)
+ {
+ /* An application is allowed to control an anonymous logger
+ * without having the permission to control the logging
+ * infrastructure.
+ */
+ if (!anonymous)
+ LogManager.getLogManager().checkAccess();
+
+ this.useParentHandlers = useParentHandlers;
+ }
+
+
+ /**
+ * Returns the parent of this logger. By default, the parent is
+ * assigned by the LogManager by inspecting the logger's name.
+ *
+ * @return the parent of this logger (as detemined by the LogManager
+ * by inspecting logger names), the root logger if no other
+ * logger has a name which is a prefix of this logger's name, or
+ * <code>null</code> for the root logger.
+ */
+ public synchronized Logger getParent()
+ {
+ return parent;
+ }
+
+
+ /**
+ * Sets the parent of this logger. Usually, applications do not
+ * call this method directly. Instead, the LogManager will ensure
+ * that the tree of loggers reflects the hierarchical logger
+ * namespace. Basically, this method should not be public at all,
+ * but the GNU implementation follows the API specification.
+ *
+ * @throws NullPointerException if <code>parent</code> is
+ * <code>null</code>.
+ *
+ * @throws SecurityException if this logger is not anonymous, a
+ * security manager exists, and the caller is not granted
+ * the permission to control the logging infrastructure by
+ * having LoggingPermission("control"). Untrusted code can
+ * obtain an anonymous logger through the static factory method
+ * {@link #getAnonymousLogger(java.lang.String) getAnonymousLogger}.
+ */
+ public synchronized void setParent(Logger parent)
+ {
+ if (parent == null)
+ throw new NullPointerException();
+
+ if (this == root)
+ throw new IllegalArgumentException(
+ "the root logger can only have a null parent");
+
+ /* An application is allowed to control an anonymous logger
+ * without having the permission to control the logging
+ * infrastructure.
+ */
+ if (!anonymous)
+ LogManager.getLogManager().checkAccess();
+
+ this.parent = parent;
+ }
+
+ /**
+ * Gets the StackTraceElement of the first class that is not this class.
+ * That should be the initial caller of a logging method.
+ * @return caller of the initial logging method or null if unknown.
+ */
+ private native StackTraceElement getCallerStackFrame();
+
+ /**
+ * Reset and close handlers attached to this logger. This function is package
+ * private because it must only be avaiable to the LogManager.
+ */
+ void resetLogger()
+ {
+ for (int i = 0; i < handlers.length; i++)
+ {
+ handlers[i].close();
+ handlerList.remove(handlers[i]);
+ }
+ handlers = getHandlers();
+ }
+}
diff --git a/libjava/java/util/logging/LoggingMXBean.h b/libjava/java/util/logging/LoggingMXBean.h
new file mode 100644
index 000000000..4bac932e4
--- /dev/null
+++ b/libjava/java/util/logging/LoggingMXBean.h
@@ -0,0 +1,22 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_LoggingMXBean__
+#define __java_util_logging_LoggingMXBean__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+
+class java::util::logging::LoggingMXBean : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::String * getLoggerLevel(::java::lang::String *) = 0;
+ virtual ::java::util::List * getLoggerNames() = 0;
+ virtual ::java::lang::String * getParentLoggerName(::java::lang::String *) = 0;
+ virtual void setLoggerLevel(::java::lang::String *, ::java::lang::String *) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_util_logging_LoggingMXBean__
diff --git a/libjava/java/util/logging/LoggingPermission.h b/libjava/java/util/logging/LoggingPermission.h
new file mode 100644
index 000000000..a3b803ac2
--- /dev/null
+++ b/libjava/java/util/logging/LoggingPermission.h
@@ -0,0 +1,22 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_LoggingPermission__
+#define __java_util_logging_LoggingPermission__
+
+#pragma interface
+
+#include <java/security/BasicPermission.h>
+
+class java::util::logging::LoggingPermission : public ::java::security::BasicPermission
+{
+
+public:
+ LoggingPermission(::java::lang::String *, ::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 63564341580231582LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_LoggingPermission__
diff --git a/libjava/java/util/logging/MemoryHandler.h b/libjava/java/util/logging/MemoryHandler.h
new file mode 100644
index 000000000..4ce638af9
--- /dev/null
+++ b/libjava/java/util/logging/MemoryHandler.h
@@ -0,0 +1,35 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_MemoryHandler__
+#define __java_util_logging_MemoryHandler__
+
+#pragma interface
+
+#include <java/util/logging/Handler.h>
+#include <gcj/array.h>
+
+
+class java::util::logging::MemoryHandler : public ::java::util::logging::Handler
+{
+
+public:
+ MemoryHandler();
+ MemoryHandler(::java::util::logging::Handler *, jint, ::java::util::logging::Level *);
+ virtual void publish(::java::util::logging::LogRecord *);
+ virtual void push();
+ virtual void flush();
+ virtual void close();
+ virtual ::java::util::logging::Level * getPushLevel();
+ virtual void setPushLevel(::java::util::logging::Level *);
+private:
+ JArray< ::java::util::logging::LogRecord * > * __attribute__((aligned(__alignof__( ::java::util::logging::Handler)))) buffer;
+ jint position;
+ jint numPublished;
+ ::java::util::logging::Level * pushLevel;
+ ::java::util::logging::Handler * target;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_MemoryHandler__
diff --git a/libjava/java/util/logging/SimpleFormatter.h b/libjava/java/util/logging/SimpleFormatter.h
new file mode 100644
index 000000000..6afece719
--- /dev/null
+++ b/libjava/java/util/logging/SimpleFormatter.h
@@ -0,0 +1,35 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_SimpleFormatter__
+#define __java_util_logging_SimpleFormatter__
+
+#pragma interface
+
+#include <java/util/logging/Formatter.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace text
+ {
+ class DateFormat;
+ }
+ }
+}
+
+class java::util::logging::SimpleFormatter : public ::java::util::logging::Formatter
+{
+
+public:
+ SimpleFormatter();
+ virtual ::java::lang::String * format(::java::util::logging::LogRecord *);
+private:
+ ::java::text::DateFormat * __attribute__((aligned(__alignof__( ::java::util::logging::Formatter)))) dateFormat;
+public: // actually package-private
+ static ::java::lang::String * lineSep;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_SimpleFormatter__
diff --git a/libjava/java/util/logging/SocketHandler.h b/libjava/java/util/logging/SocketHandler.h
new file mode 100644
index 000000000..8286f1352
--- /dev/null
+++ b/libjava/java/util/logging/SocketHandler.h
@@ -0,0 +1,25 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_SocketHandler__
+#define __java_util_logging_SocketHandler__
+
+#pragma interface
+
+#include <java/util/logging/StreamHandler.h>
+
+class java::util::logging::SocketHandler : public ::java::util::logging::StreamHandler
+{
+
+public:
+ SocketHandler();
+ SocketHandler(::java::lang::String *, jint);
+private:
+ static jint getPortNumber();
+ static ::java::io::OutputStream * createSocket(::java::lang::String *, jint);
+public:
+ virtual void publish(::java::util::logging::LogRecord *);
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_SocketHandler__
diff --git a/libjava/java/util/logging/StreamHandler.h b/libjava/java/util/logging/StreamHandler.h
new file mode 100644
index 000000000..11dca983f
--- /dev/null
+++ b/libjava/java/util/logging/StreamHandler.h
@@ -0,0 +1,43 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_StreamHandler__
+#define __java_util_logging_StreamHandler__
+
+#pragma interface
+
+#include <java/util/logging/Handler.h>
+
+class java::util::logging::StreamHandler : public ::java::util::logging::Handler
+{
+
+public:
+ StreamHandler();
+ StreamHandler(::java::io::OutputStream *, ::java::util::logging::Formatter *);
+public: // actually package-private
+ StreamHandler(::java::io::OutputStream *, ::java::lang::String *, ::java::util::logging::Level *, ::java::util::logging::Formatter *, ::java::lang::Class *);
+private:
+ void checkOpen();
+ void checkFresh();
+ void changeWriter(::java::io::OutputStream *, ::java::lang::String *);
+public:
+ virtual void setEncoding(::java::lang::String *);
+public: // actually protected
+ virtual void setOutputStream(::java::io::OutputStream *);
+public:
+ virtual void publish(::java::util::logging::LogRecord *);
+ virtual jboolean isLoggable(::java::util::logging::LogRecord *);
+ virtual void flush();
+ virtual void close();
+private:
+ ::java::io::OutputStream * __attribute__((aligned(__alignof__( ::java::util::logging::Handler)))) out;
+ ::java::io::Writer * writer;
+ jint streamState;
+ static const jint STATE_FRESH = 0;
+ static const jint STATE_PUBLISHED = 1;
+ static const jint STATE_CLOSED = 2;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_StreamHandler__
diff --git a/libjava/java/util/logging/XMLFormatter.h b/libjava/java/util/logging/XMLFormatter.h
new file mode 100644
index 000000000..a5de35435
--- /dev/null
+++ b/libjava/java/util/logging/XMLFormatter.h
@@ -0,0 +1,50 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_util_logging_XMLFormatter__
+#define __java_util_logging_XMLFormatter__
+
+#pragma interface
+
+#include <java/util/logging/Formatter.h>
+extern "Java"
+{
+ namespace gnu
+ {
+ namespace java
+ {
+ namespace lang
+ {
+ class CPStringBuilder;
+ }
+ }
+ }
+ namespace java
+ {
+ namespace text
+ {
+ class SimpleDateFormat;
+ }
+ }
+}
+
+class java::util::logging::XMLFormatter : public ::java::util::logging::Formatter
+{
+
+public:
+ XMLFormatter();
+private:
+ static void appendTag(::gnu::java::lang::CPStringBuilder *, jint, ::java::lang::String *, ::java::lang::String *);
+ static void appendTag(::gnu::java::lang::CPStringBuilder *, jint, ::java::lang::String *, jlong);
+public:
+ virtual ::java::lang::String * format(::java::util::logging::LogRecord *);
+ virtual ::java::lang::String * getHead(::java::util::logging::Handler *);
+ virtual ::java::lang::String * getTail(::java::util::logging::Handler *);
+private:
+ static ::java::lang::String * lineSep;
+ ::java::text::SimpleDateFormat * __attribute__((aligned(__alignof__( ::java::util::logging::Formatter)))) iso8601;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_util_logging_XMLFormatter__
diff --git a/libjava/java/util/logging/natLogger.cc b/libjava/java/util/logging/natLogger.cc
new file mode 100644
index 000000000..5c68b1722
--- /dev/null
+++ b/libjava/java/util/logging/natLogger.cc
@@ -0,0 +1,49 @@
+// natLogger.cc - Native part of Logger class.
+
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
+
+ This Logger is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the Logger "LIBGCJ_LICENSE" for
+details. */
+
+#include <config.h>
+#include <platform.h>
+
+#include <string.h>
+
+#pragma implementation "Logger.h"
+
+#include <gcj/cni.h>
+#include <jvm.h>
+#include <java-stack.h>
+
+#include <java/lang/Object.h>
+#include <java/lang/Class.h>
+#include <java/util/logging/Logger.h>
+#include <java/lang/StackTraceElement.h>
+#include <java/lang/ArrayIndexOutOfBoundsException.h>
+
+using namespace java::util::logging;
+
+java::lang::StackTraceElement*
+java::util::logging::Logger::getCallerStackFrame ()
+{
+ jclass klass = NULL;
+ _Jv_Method *meth = NULL;
+ _Jv_StackTrace::GetCallerInfo (&Logger::class$, &klass, &meth);
+
+ jstring meth_name = NULL;
+ jstring klass_name = NULL;
+ if (klass != NULL)
+ klass_name = klass->getName();
+ if (meth != NULL)
+ meth_name = _Jv_NewStringUtf8Const (meth->name);
+
+ java::lang::StackTraceElement *e
+ = new java::lang::StackTraceElement
+ (JvNewStringUTF (""), 0, klass_name, meth_name, false);
+
+ return e;
+}