# HG changeset patch # User alanb # Date 1301443223 -3600 # Node ID 799504d1fdcca1ecc6e8a5c8a04fe743d998c0e5 # Parent 6679e1339581ac873886d9d6641669b68ff5f0d8# Parent 117374ccf1b7b840f5319dd5befa396723dbe04d Merge diff -r 6679e1339581 -r 799504d1fdcc jdk/src/share/classes/com/sun/security/auth/PolicyParser.java --- a/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java Wed Mar 30 00:59:07 2011 +0100 +++ b/jdk/src/share/classes/com/sun/security/auth/PolicyParser.java Wed Mar 30 01:00:23 2011 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,13 +30,14 @@ import java.net.MalformedURLException; import java.net.SocketPermission; import java.net.URL; +import java.security.GeneralSecurityException; +import java.text.MessageFormat; import java.util.Enumeration; import java.util.Hashtable; import java.util.LinkedList; import java.util.ListIterator; import java.util.Vector; import java.util.StringTokenizer; -import java.security.GeneralSecurityException; import sun.security.util.PropertyExpander; /** @@ -368,8 +369,8 @@ "WILDCARD class but no WILDCARD name"); throw new ParsingException (st.lineno(), - rb.getString("can.not.specify.Principal.with.a.") + - rb.getString("wildcard.class.without.a.wildcard.name")); + rb.getString("can.not.specify.Principal.with.a." + + "wildcard.class.without.a.wildcard.name")); } try { @@ -525,9 +526,10 @@ rb.getString("number.") + String.valueOf(st.nval)); case StreamTokenizer.TT_EOF: - throw new ParsingException - (rb.getString("expected.") + expect + - rb.getString(".read.end.of.file")); + MessageFormat form = new MessageFormat( + rb.getString("expected.expect.read.end.of.file.")); + Object[] source = {expect}; + throw new ParsingException(form.format(source)); case StreamTokenizer.TT_WORD: if (expect.equalsIgnoreCase(st.sval)) { lookahead = st.nextToken(); diff -r 6679e1339581 -r 799504d1fdcc jdk/src/share/classes/java/lang/management/BufferPoolMXBean.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/classes/java/lang/management/BufferPoolMXBean.java Wed Mar 30 01:00:23 2011 +0100 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code 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 + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang.management; + +/** + * The management interface for a buffer pool, for example a pool of + * {@link java.nio.ByteBuffer#allocateDirect direct} or {@link + * java.nio.MappedByteBuffer mapped} buffers. + * + *
A class implementing this interface is an + * {@link javax.management.MXBean}. A Java + * virtual machine has one or more implementations of this interface. The {@link + * java.lang.management.ManagementFactory#getPlatformMXBeans getPlatformMXBeans} + * method can be used to obtain the list of {@code BufferPoolMXBean} objects + * representing the management interfaces for pools of buffers as follows: + *
+ * List<BufferPoolMXBean> pools = ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class); + *+ * + *
The management interfaces are also registered with the platform {@link + * javax.management.MBeanServer MBeanServer}. The {@link + * javax.management.ObjectName ObjectName} that uniquely identifies the + * management interface within the {@code MBeanServer} takes the form: + *
+ * java.nio:type=BufferPool,name=pool name + *+ * where pool name is the {@link #getName name} of the buffer pool. + * + * @since 1.7 + */ +public interface BufferPoolMXBean extends PlatformManagedObject { + + /** + * Returns the name representing this buffer pool. + * + * @return The name of this buffer pool. + */ + String getName(); + + /** + * Returns an estimate of the number of buffers in the pool. + * + * @return An estimate of the number of buffers in this pool + */ + long getCount(); + + /** + * Returns an estimate of the total capacity of the buffers in this pool. + * A buffer's capacity is the number of elements it contains and the value + * returned by this method is an estimate of the total capacity of buffers + * in the pool in bytes. + * + * @return An estimate of the total capacity of the buffers in this pool + * in bytes + */ + long getTotalCapacity(); + + /** + * Returns an estimate of the memory that the Java virtual machine is using + * for this buffer pool. The value returned by this method may differ + * from the estimate of the total {@link #getTotalCapacity capacity} of + * the buffers in this pool. This difference is explained by alignment, + * memory allocator, and other implementation specific reasons. + * + * @return An estimate of the memory that the Java virtual machine is using + * for this buffer pool in bytes, or {@code -1L} if an estimate of + * the memory usage is not available + */ + long getMemoryUsed(); +} diff -r 6679e1339581 -r 799504d1fdcc jdk/src/share/classes/java/lang/management/ManagementFactory.java --- a/jdk/src/share/classes/java/lang/management/ManagementFactory.java Wed Mar 30 00:59:07 2011 +0100 +++ b/jdk/src/share/classes/java/lang/management/ManagementFactory.java Wed Mar 30 01:00:23 2011 +0100 @@ -40,8 +40,9 @@ import javax.management.StandardEmitterMBean; import javax.management.StandardMBean; import java.util.Collections; -import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.TreeSet; import java.security.AccessController; import java.security.Permission; import java.security.PrivilegedAction; @@ -51,37 +52,63 @@ import sun.management.ManagementFactoryHelper; /** - * The ManagementFactory class is a factory class for getting + * The {@code ManagementFactory} class is a factory class for getting * managed beans for the Java platform. * This class consists of static methods each of which returns - * one or more platform MXBean(s) representing + * one or more platform MXBeans representing * the management interface of a component of the Java virtual * machine. + *
+ *
+ * A platform MXBean is a managed bean that + * conforms to the JMX + * Instrumentation Specification and only uses a set of basic data types. + * A JMX management application and the {@linkplain + * #getPlatformMBeanServer platform MBeanServer} + * can interoperate without requiring classes for MXBean specific + * data types. + * The data types being transmitted between the JMX connector + * server and the connector client are + * {@linkplain javax.management.openmbean.OpenType open types} + * and this allows interoperation across versions. + * See + * the specification of MXBeans for details. + * + * + *
Each platform MXBean is a {@link PlatformManagedObject} + * and it has a unique + * {@link javax.management.ObjectName ObjectName} for + * registration in the platform {@code MBeanServer} as returned by + * by the {@link PlatformManagedObject#getObjectName getObjectName} + * method. * *
* An application can access a platform MXBean in the following ways: + *
** *- *
+ *- Direct access to an MXBean interface - *
- *- *
- Get the MXBean instance through the static factory method, - * or the {@link #getPlatformMXBeans(Class)} method - * and access the MXBean locally of the running + *
- Get an MXBean instance by calling the + * {@link #getPlatformMXBean(Class) getPlatformMXBean} or + * {@link #getPlatformMXBeans(Class) getPlatformMXBeans} method + * and access the MXBean locally in the running * virtual machine. *
*- Construct an MXBean proxy instance that forwards the * method calls to a given {@link MBeanServer MBeanServer} by calling - * the {@link #newPlatformMXBeanProxy newPlatformMXBeanProxy} method - * or the {@link #getPlatformMXBeans(MBeanServerConnection, Class)} - * method. + * the {@link #getPlatformMXBean(MBeanServerConnection, Class)} or + * {@link #getPlatformMXBeans(MBeanServerConnection, Class)} method. + * The {@link #newPlatformMXBeanProxy newPlatformMXBeanProxy} method + * can also be used to construct an MXBean proxy instance of + * a given {@code ObjectName}. * A proxy is typically constructed to remotely access * an MXBean of another running virtual machine. *
- *- Indirect access to an MXBean interface via MBeanServer - *
- *
- Go through the {@link #getPlatformMBeanServer - * platform MBeanServer} to access MXBeans locally or - * a specific MBeanServerConnection to access + *
2. Indirect access to an MXBean interface via MBeanServer
+ *+ *
- * - *- Go through the platform {@code MBeanServer} to access MXBeans + * locally or a specific MBeanServerConnection to access * MXBeans remotely. * The attributes and operations of an MXBean use only * JMX open types which include basic data types, @@ -89,133 +116,19 @@ * and {@link javax.management.openmbean.TabularData TabularData} * defined in * {@link javax.management.openmbean.OpenType OpenType}. - * The mapping is specified below. + * The mapping is specified in + * the {@linkplain javax.management.MXBean MXBean} specification + * for details. *
- * *Platform MXBeans
- * A platform MXBean is a managed bean that conforms to - * the JMX Instrumentation Specification and only uses - * a set of basic data types described below. - * See - * the specification of MXBeans for details. - * All platform MXBean interfaces extend {@link PlatformManagedObject}s - * and new methods may be added in these interfaces - * in future Java SE releases. - *- * A JMX management application and the platform MBeanServer - * can interoperate without requiring classes for MXBean specific - * data types. - * The data types being transmitted between the JMX connector - * server and the connector client are - * {@linkplain javax.management.openmbean.OpenType open types} - * and this allows interoperation across versions. - *
- * The platform MXBean interfaces use only the following data types: - *
- *
+ *- Primitive types such as int, long, - * boolean, etc
- *- Wrapper classes for primitive types such as - * {@link java.lang.Integer Integer}, {@link java.lang.Long Long}, - * {@link java.lang.Boolean Boolean}, etc and - * {@link java.lang.String String}
- *- {@link java.lang.Enum Enum} classes
- *- Classes that define only getter methods and define a static - * from method with a - * {@link javax.management.openmbean.CompositeData CompositeData} - * argument to convert from an input CompositeData to - * an instance of that class - *
- *- {@link java.util.List List<E>} - * where E is a primitive type, a wrapper class, - * an enum class, or a class supporting conversion from a - * CompositeData to its class - *
- *- {@link java.util.Map Map<K,V>} - * where K and V are - * a primitive type, a wrapper class, - * an enum class, or a class supporting conversion from a - * CompositeData to its class - *
- *
- * When an attribute or operation of a platform MXBean - * is accessed via an MBeanServer, the data types are mapped - * as follows: - *
- * For example, the {@link MemoryMXBean} - * interface has the following getter and setter methods: - * - *
- * - * These attributes in the MBeanInfo - * of the MemoryMXBean have the following names and types: - * - *- * public MemoryUsage getHeapMemoryUsage(); - * public boolean isVerbose(); - * public void setVerbose(boolean value); - *
- *- * - *- *
- *- * - *Attribute Name - *Type - *- * - *HeapMemoryUsage - *{@link MemoryUsage#from - * CompositeData representing MemoryUsage} - *- * - *Verbose - *boolean - *
* MXBeans that get created and destroyed dynamically, for example, * memory {@link MemoryPoolMXBean pools} and * {@link MemoryManagerMXBean managers}, * will automatically be registered and deregistered into the platform - * MBeanServer. + * {@code MBeanServer}. *
- * If the system property javax.management.builder.initial - * is set, the platform MBeanServer creation will be done + * If the system property {@code javax.management.builder.initial} + * is set, the platform {@code MBeanServer} creation will be done * by the specified {@link javax.management.MBeanServerBuilder}. *
* It is recommended that this platform MBeanServer also be used * to register other application managed beans * besides the platform MXBeans. * This will allow all MBeans to be published through the same - * MBeanServer and hence allow for easier network publishing + * {@code MBeanServer} and hence allow for easier network publishing * and discovery. * Name conflicts with the platform MXBeans should be avoided. * - * @return the platform MBeanServer; the platform - * MXBeans are registered into the platform MBeanServer + * @return the platform {@code MBeanServer}; the platform + * MXBeans are registered into the platform {@code MBeanServer} * at the first time this method is called. * * @exception SecurityException if there is a security manager @@ -671,7 +592,9 @@ try { final ObjectName objName = new ObjectName(mxbeanName); - if (!connection.isInstanceOf(objName, interfaceClass.getName())) { + // skip the isInstanceOf check for LoggingMXBean + String intfName = interfaceClass.getName(); + if (!connection.isInstanceOf(objName, intfName)) { throw new IllegalArgumentException(mxbeanName + " is not an instance of " + interfaceClass); } @@ -683,55 +606,128 @@ // create an MXBean proxy return JMX.newMXBeanProxy(connection, objName, mxbeanInterface, emitter); - } catch (InstanceNotFoundException e) { - final IllegalArgumentException iae = - new IllegalArgumentException(mxbeanName + - " not found in the connection."); - iae.initCause(e); - throw iae; - } catch (MalformedObjectNameException e) { - final IllegalArgumentException iae = - new IllegalArgumentException(mxbeanName + - " is not a valid ObjectName format."); - iae.initCause(e); - throw iae; + } catch (InstanceNotFoundException|MalformedObjectNameException e) { + throw new IllegalArgumentException(e); } } /** - * Returns the list of platform MXBeans that implement - * the given {@code mxbeanInterface} in the running Java + * Returns the platform MXBean implementing + * the given {@code mxbeanInterface} which is specified + * to have one single instance in the Java virtual machine. + * This method may return {@code null} if the management interface + * is not implemented in the Java virtual machine (for example, + * a Java virtual machine with no compilation system does not + * implement {@link CompilationMXBean}); + * otherwise, this method is equivalent to calling: + *
+ * {@link #getPlatformMXBeans(Class) + * getPlatformMXBeans(mxbeanInterface)}.get(0); + *+ * + * @param mxbeanInterface a management interface for a platform + * MXBean with one single instance in the Java virtual machine + * if implemented. + * + * @return the platform MXBean that implements + * {@code mxbeanInterface}, or {@code null} if not exist. + * + * @throws IllegalArgumentException if {@code mxbeanInterface} + * is not a platform management interface or + * not a singleton platform MXBean. + * + * @since 1.7 + */ + public static
+ * {@link #getPlatformMXBeans(MBeanServerConnection, Class) + * getPlatformMXBeans(connection, mxbeanInterface)}.get(0); + *+ * + * @param connection the {@code MBeanServerConnection} to forward to. + * @param mxbeanInterface a management interface for a platform + * MXBean with one single instance in the Java virtual machine + * being monitored, if implemented. + * + * @return the platform MXBean proxy for + * forwarding the method calls of the {@code mxbeanInterface} + * through the given {@code MBeanServerConnection}, + * or {@code null} if not exist. + * + * @throws IllegalArgumentException if {@code mxbeanInterface} + * is not a platform management interface or + * not a singleton platform MXBean. + * @throws java.io.IOException if a communication problem + * occurred when accessing the {@code MBeanServerConnection}. + * + * @see #newPlatformMXBeanProxy + * @since 1.7 + */ + public static
There is a single global instance of the PlatformLoggingMXBean. + * The {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class) + * ManagementFactory.getPlatformMXBean} method can be used to obtain + * the {@code PlatformLoggingMXBean} object as follows: + *
+ * PlatformLoggingMXBean logging = ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class); + *+ * The {@code PlatformLoggingMXBean} object is also registered with the + * platform {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer + * MBeanServer}. + * The {@link javax.management.ObjectName ObjectName} for uniquely + * identifying the {@code PlatformLoggingMXBean} within an MBeanServer is: + *
+ * {@link java.util.logging.LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging} + *+ * + *
The instance registered in the platform MBeanServer with
+ * this {@code ObjectName} implements all attributes defined by
+ * {@link java.util.logging.LoggingMXBean}.
+ *
+ * @since 1.7
+ */
+public interface PlatformLoggingMXBean extends PlatformManagedObject {
+
+ /**
+ * Returns the list of the currently registered
+ * {@linkplain java.util.logging.Logger logger} names. This method
+ * calls {@link java.util.logging.LogManager#getLoggerNames} and
+ * returns a list of the logger names.
+ *
+ * @return A list of {@code String} each of which is a
+ * currently registered {@code Logger} name.
+ */
+ java.util.List
+ * If the {@code Level} of the specified logger is {@code null},
+ * which means that this logger's effective level is inherited
+ * from its parent, an empty string will be returned.
+ *
+ * @param loggerName The name of the {@code Logger} to be retrieved.
+ *
+ * @return The name of the log level of the specified logger; or
+ * an empty string if the log level of the specified logger
+ * is {@code null}. If the specified logger does not
+ * exist, {@code null} is returned.
+ *
+ * @see java.util.logging.Logger#getLevel
+ */
+ String getLoggerLevel(String loggerName);
+
+ /**
+ * Sets the specified logger to the specified new
+ * {@linkplain java.util.logging.Logger#setLevel level}.
+ * If the {@code levelName} is not {@code null}, the level
+ * of the specified logger is set to the parsed
+ * {@link java.util.logging.Level Level}
+ * matching the {@code levelName}.
+ * If the {@code levelName} is {@code null}, the level
+ * of the specified logger is set to {@code null} and
+ * the effective level of the logger is inherited from
+ * its nearest ancestor with a specific (non-null) level value.
+ *
+ * @param loggerName The name of the {@code Logger} to be set.
+ * Must be non-null.
+ * @param levelName The name of the level to set on the specified logger,
+ * or {@code null} if setting the level to inherit
+ * from its nearest ancestor.
+ *
+ * @throws IllegalArgumentException if the specified logger
+ * does not exist, or {@code levelName} is not a valid level name.
+ *
+ * @throws SecurityException if a security manager exists and if
+ * the caller does not have LoggingPermission("control").
+ *
+ * @see java.util.logging.Logger#setLevel
+ */
+ void setLoggerLevel(String loggerName, String levelName);
+
+ /**
+ * Returns the name of the
+ * {@linkplain java.util.logging.Logger#getParent parent}
+ * for the specified logger.
+ * If the specified logger does not exist, {@code null} is returned.
+ * If the specified logger is the root {@code Logger} in the namespace,
+ * the result will be an empty string.
+ *
+ * @param loggerName The name of a {@code Logger}.
+ *
+ * @return the name of the nearest existing parent logger;
+ * an empty string if the specified logger is the root logger.
+ * If the specified logger does not exist, {@code null}
+ * is returned.
+ */
+ String getParentLoggerName(String loggerName);
+}
diff -r 6679e1339581 -r 799504d1fdcc jdk/src/share/classes/java/lang/management/PlatformManagedObject.java
--- a/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java Wed Mar 30 00:59:07 2011 +0100
+++ b/jdk/src/share/classes/java/lang/management/PlatformManagedObject.java Wed Mar 30 01:00:23 2011 +0100
@@ -46,7 +46,7 @@
* intended for the management interfaces for the platform to extend but
* not for applications.
*
- * @see Platform MXBeans
+ * @see ManagementFactory
* @since 1.7
*/
public interface PlatformManagedObject {
diff -r 6679e1339581 -r 799504d1fdcc jdk/src/share/classes/java/lang/management/package.html
--- a/jdk/src/share/classes/java/lang/management/package.html Wed Mar 30 00:59:07 2011 +0100
+++ b/jdk/src/share/classes/java/lang/management/package.html Wed Mar 30 01:00:23 2011 +0100
@@ -27,160 +27,124 @@
- Management Interface Description
-A platform MXBean is a managed bean that defines the management
-interface for one component for the platform and is specified in the
-
-ManagementFactory class.
-
- An application can monitor the instrumentation of the
-Java virtual machine and manage certain characteristics in
-the following ways:
-
The {@link java.lang.management.ManagementFactory} class is the management
+factory class for the Java platform. This class provides a set of
static factory methods to obtain the MXBeans for the Java platform
to allow an application to access the MXBeans directly.
A platform MBeanServer can be accessed with the
{@link java.lang.management.ManagementFactory#getPlatformMBeanServer
getPlatformMBeanServer} method. On the first call to this method,
-it creates the platform MBeanServer and registers all platform MXBeans
-including platform MXBeans defined in other packages such as
-{@link java.util.logging.LoggingMXBean}.
-Each platform MXBean is registered with a unique name defined in the
-{@link java.lang.management.ManagementFactory ManagementFactory} class
-for constructing {@link javax.management.ObjectName ObjectName}.
-This is a single MBeanServer that can be shared by different managed
+it creates the platform MBeanServer and registers all platform MXBeans
+including {@linkplain java.lang.management.PlatformManagedObject
+platform MXBeans}.
+Each platform MXBean is registered with a unique name defined in
+the specification of the management interface.
+This is a single MBeanServer that can be shared by different managed
components running within the same Java virtual machine.
-
+
A management application and a platform MBeanServer of a running
+virtual machine can interoperate
without requiring classes used by the platform MXBean interfaces.
The data types being transmitted between the JMX connector
server and the connector client are JMX
-{@link javax.management.openmbean.OpenType open types} and
+{@linkplain javax.management.openmbean.OpenType open types} and
this allows interoperation across versions.
-
- A data type used by the MXBean interfaces are mapped to
-an open type when being accessed via MBeanServer interface.
-The data type mapping is specified in the
-{@link java.lang.management.ManagementFactory ManagementFactory} class.
+A data type used by the MXBean interfaces are mapped to an
+open type when being accessed via MBeanServer interface.
+See the
+MXBean specification for details.
An application can monitor the instrumentation of the
+Java virtual machine and the runtime in the following ways:
-
+
+ Or by calling the
+ {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
+ getPlatformMXBean} or
+ {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class)
+ getPlatformMXBeans} method:
+
+ A proxy is typically used to access an MXBean
+ in a remote Java virtual machine.
+ An alternative way to create an MXBean proxy is:
+
+2. Indirect access to an MXBean interface via MBeanServer
+
+ A Java virtual machine implementation may add its platform extension to
the management interface by defining platform-dependent
interfaces that extend the standard management interfaces to include
-platform-specific metrics and management operations.
+platform-specific metrics and management operations.
The static factory methods in the ManagementFactory class will
-return the MBeans with the platform extension.
+return the MXBeans with the platform extension.
It is recommended to name the platform-specific attributes with
@@ -240,26 +187,30 @@
the applications accessing that vendor-specific attribute would have
to be modified to cope with versioning and compatibility issues.
- Below is an example showing how to access a platform-specific
-attribute from Sun's implementation of the RuntimeMXBean.
+ Below is an example showing how to access an attribute
+from the platform extension:
-1) Direct access to the Sun-specific MXBean interface
-
-2) Access the Sun-specific MXBean interface via MBeanServer
+2) Access the Oracle-specific MXBean interface via MBeanServer
+ through proxy
Unless otherwise noted, passing a null argument to a constructor
diff -r 6679e1339581 -r 799504d1fdcc jdk/src/share/classes/java/nio/BufferPoolMXBean.java
--- a/jdk/src/share/classes/java/nio/BufferPoolMXBean.java Wed Mar 30 00:59:07 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.nio;
-
-import java.lang.management.PlatformManagedObject;
-
-/**
- * The management interface for a buffer pool.
- *
- * A class implementing this interface is an MXBean. A Java
- * virtual machine has one or more implementations of this interface. The {@link
- * java.lang.management.ManagementFactory#getPlatformMXBeans getPlatformMXBeans}
- * method can be used to obtain the list of {@code BufferPoolMXBean} objects
- * representing the management interfaces for pools of buffers as follows:
- * The management interfaces are also registered with the platform {@link
- * javax.management.MBeanServer MBeanServer}. The {@link
- * javax.management.ObjectName ObjectName} that uniquely identifies the
- * management interface within the {@code MBeanServer} takes the form:
- * There is a single global instance of the LoggingMXBean.
- * This instance is an
- * MXBean
- * can be obtained by calling
- * the {@link LogManager#getLoggingMXBean} method or from the
+ * This instance is an {@link javax.management.MXBean MXBean} that
+ * can be obtained by calling the {@link LogManager#getLoggingMXBean}
+ * method or from the
* {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
* platform MBeanServer}.
- *
- * The {@link javax.management.ObjectName ObjectName} for uniquely
- * identifying the LoggingMXBean within an MBeanServer is:
- *
+ * The {@link javax.management.ObjectName ObjectName} that uniquely identifies
+ * the management interface for logging within the {@code MBeanServer} is:
+ *
+ * The instance registered in the platform {@code MBeanServer}
+ * is also a {@link java.lang.management.PlatformLoggingMXBean}.
*
* @author Ron Mann
* @author Mandy Chung
* @since 1.5
*
- * @see PlatformLoggingMXBean
+ * @see java.lang.management.PlatformLoggingMXBean
*/
public interface LoggingMXBean {
/**
- * Returns the list of currently registered loggers. This method
+ * Returns the list of currently registered logger names. This method
* calls {@link LogManager#getLoggerNames} and returns a list
* of the logger names.
*
@@ -89,7 +94,7 @@
*
* @see Logger#getLevel
*/
- public String getLoggerLevel( String loggerName );
+ public String getLoggerLevel(String loggerName);
/**
* Sets the specified logger to the specified new level.
@@ -115,7 +120,7 @@
*
* @see Logger#setLevel
*/
- public void setLoggerLevel( String loggerName, String levelName );
+ public void setLoggerLevel(String loggerName, String levelName);
/**
* Returns the name of the parent for the specified logger.
diff -r 6679e1339581 -r 799504d1fdcc jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java
--- a/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java Wed Mar 30 00:59:07 2011 +0100
+++ b/jdk/src/share/classes/java/util/logging/LoggingProxyImpl.java Wed Mar 30 01:00:23 2011 +0100
@@ -99,4 +99,9 @@
public String getLevelName(Object level) {
return ((Level) level).getName();
}
+
+ @Override
+ public String getProperty(String key) {
+ return LogManager.getLogManager().getProperty(key);
+ }
}
diff -r 6679e1339581 -r 799504d1fdcc jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java
--- a/jdk/src/share/classes/java/util/logging/PlatformLoggingMXBean.java Wed Mar 30 00:59:07 2011 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code 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
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package java.util.logging;
-
-import java.lang.management.PlatformManagedObject;
-
-/**
- * The {@linkplain PlatformManagedObject platform managed object} for the
- * logging facility. This interface simply unifies {@link LoggingMXBean}
- * {@link PlatformManagedObject};
- * and it does not specify any new operations.
- *
- * The {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class)
- * ManagementFactory.getPlatformMXBeans} method can be used to obtain
- * the {@code PlatformLoggingMXBean} object as follows:
- *
+ *
+ * Configuration:
+ * The {@code SimpleFormatter} is initialized with the
+ * format string
+ * specified in the {@code java.util.logging.SimpleFormatter.format}
+ * property to {@linkplain #format format} the log messages.
+ * This property can be defined
+ * in the {@linkplain LogManager#getProperty logging properties}
+ * configuration file
+ * or as a system property. If this property is set in both
+ * the logging properties and system properties,
+ * the format string specified in the system property will be used.
+ * If this property is not defined or the given format string
+ * is {@linkplain java.util.IllegalFormatException illegal},
+ * the default format is implementation-specific.
+ *
* @since 1.4
+ * @see java.util.Formatter
*/
public class SimpleFormatter extends Formatter {
- Date dat = new Date();
- private final static String format = "{0,date} {0,time}";
- private MessageFormat formatter;
-
- private Object args[] = new Object[1];
-
- // Line separator string. This is the value of the line.separator
- // property at the moment that the SimpleFormatter was created.
- private String lineSeparator = java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("line.separator"));
+ // format string for printing the log record
+ private static final String format = LoggingSupport.getSimpleFormat();
+ private final Date dat = new Date();
/**
* Format the given LogRecord.
*
- * This method can be overridden in a subclass.
+ * The formatting can be customized by specifying the
+ * format string
+ * in the
+ * {@code java.util.logging.SimpleFormatter.format} property.
+ * The given {@code LogRecord} will be formatted as if by calling:
+ * Some example formats: This prints 1 line with the log level ({@code 4$}),
+ * the log message ({@code 5$}) and the timestamp ({@code 1$}) in
+ * a square bracket.
+ * This prints 2 lines where the first line includes
+ * the timestamp ({@code 1$}) and the source ({@code 2$});
+ * the second line includes the log level ({@code 4$}) and
+ * the log message ({@code 5$}) followed with the throwable
+ * and its backtrace ({@code 6$}), if any:
+ * This prints 2 lines similar to the example above
+ * with a different date/time formatting and does not print
+ * the throwable and its backtrace:
+ * This method can also be overridden in a subclass.
* It is recommended to use the {@link Formatter#formatMessage}
* convenience method to localize and format the message field.
*
@@ -61,42 +138,32 @@
* @return a formatted log record
*/
public synchronized String format(LogRecord record) {
- StringBuffer sb = new StringBuffer();
- // Minimize memory allocations here.
dat.setTime(record.getMillis());
- args[0] = dat;
- StringBuffer text = new StringBuffer();
- if (formatter == null) {
- formatter = new MessageFormat(format);
- }
- formatter.format(args, text, null);
- sb.append(text);
- sb.append(" ");
+ String source;
if (record.getSourceClassName() != null) {
- sb.append(record.getSourceClassName());
+ source = record.getSourceClassName();
+ if (record.getSourceMethodName() != null) {
+ source += " " + record.getSourceMethodName();
+ }
} else {
- sb.append(record.getLoggerName());
+ source = record.getLoggerName();
}
- if (record.getSourceMethodName() != null) {
- sb.append(" ");
- sb.append(record.getSourceMethodName());
- }
- sb.append(lineSeparator);
String message = formatMessage(record);
- sb.append(record.getLevel().getLocalizedName());
- sb.append(": ");
- sb.append(message);
- sb.append(lineSeparator);
+ String throwable = "";
if (record.getThrown() != null) {
- try {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- record.getThrown().printStackTrace(pw);
- pw.close();
- sb.append(sw.toString());
- } catch (Exception ex) {
- }
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ pw.println();
+ record.getThrown().printStackTrace(pw);
+ pw.close();
+ throwable = sw.toString();
}
- return sb.toString();
+ return String.format(format,
+ dat,
+ source,
+ record.getLoggerName(),
+ record.getLevel().getLocalizedName(),
+ message,
+ throwable);
}
}
diff -r 6679e1339581 -r 799504d1fdcc jdk/src/share/classes/sun/management/ManagementFactoryHelper.java
--- a/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java Wed Mar 30 00:59:07 2011 +0100
+++ b/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java Wed Mar 30 01:00:23 2011 +0100
@@ -27,20 +27,18 @@
import java.lang.management.*;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
+import javax.management.MBeanServer;
import javax.management.MBeanRegistrationException;
import javax.management.NotCompliantMBeanException;
+import javax.management.ObjectName;
import javax.management.RuntimeOperationsException;
-import java.nio.BufferPoolMXBean;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import sun.security.action.LoadLibraryAction;
-import java.util.logging.PlatformLoggingMXBean;
import sun.util.logging.LoggingSupport;
import java.util.ArrayList;
@@ -139,61 +137,80 @@
return result;
}
- public static List
+ * {@link java.util.logging.Logger#getLevel
+ * Logger.getLevel()}.{@link java.util.logging.Level#getName getName()};
+ *
+ *
+ * Platform MXBeans
-
-This package defines the management interface of the following
-components:
+Provides the management interfaces for monitoring and management of the
+Java virtual machine and other components in the Java runtime.
+It allows both local and remote
+monitoring and management of the running Java virtual machine.
+
-
-
+
-
-
-
-
-
-
-
- {@link java.lang.management.ClassLoadingMXBean}
- Class loading system of the Java virtual machine.
-
-
- {@link java.lang.management.CompilationMXBean}
- Compilation system of the Java virtual machine.
-
-
- {@link java.lang.management.MemoryMXBean}
- Memory system of the Java virtual machine.
-
-
- {@link java.lang.management.ThreadMXBean}
- Threads system of the Java virtual machine.
-
-
- {@link java.lang.management.RuntimeMXBean}
- Runtime system of the Java virtual machine.
-
-
- {@link java.lang.management.OperatingSystemMXBean}
- Operating system on which the Java virtual machine is running.
-
-
- {@link java.lang.management.GarbageCollectorMXBean}
- Garbage collector in the Java virtual machine.
-
-
- {@link java.lang.management.MemoryManagerMXBean}
- Memory manager in the Java virtual machine.
-
-
- {@link java.lang.management.MemoryPoolMXBean}
- Memory pool in the Java virtual machine.
-Platform MXBean
-
-
-Below shows a few examples of different
-ways to access MXBeans.
-
+A platform MXBean is a managed bean that
+conforms to the JMX
+Instrumentation Specification and only uses a set of basic data types.
+Each platform MXBean is a {@link java.lang.management.PlatformManagedObject}
+with a unique
+{@linkplain java.lang.management.PlatformManagedObject#getObjectName name}.
+
-
-
ManagementFactory
-The {@link java.lang.management.ManagementFactory} class is the management
-factory class for the Java platform. This class provides a set of
+Interoperability
-A management application and a platform MBeanServer of a running
-virtual machine can interoperate
+Ways to Access MXBeans
-There are three different ways to access the management interfaces.
-
+
-
+
+
+
+
+1. Direct access to an MXBean interface
+
+
RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
// Get the standard attribute "VmVendor"
String vendor = mxbean.getVmVendor();
-
-
+ RuntimeMXBean mxbean = ManagementFactory.getPlatformMXBean(RuntimeMXBean.class);
+
+ // Get the standard attribute "VmVendor"
+ String vendor = mxbean.getVmVendor();
+
+
+ MBeanServerConnection mbs;
-
-
-
+ // Connect to a running JVM (or itself) and get MBeanServerConnection
+ // that has the JVM MBeans registered in it
+ ...
+
+ // Get a MBean proxy for RuntimeMXBean interface
+ RuntimeMXBean proxy =
+ {@link java.lang.management.ManagementFactory#getPlatformMXBean(MBeanServerConnection, Class)
+ ManagementFactory.getPlatformMXBean}(mbs,
+ RuntimeMXBean.class);
+ // Get standard attribute "VmVendor"
+ String vendor = proxy.getVmVendor();
+
+
+ RuntimeMXBean proxy =
+ {@link java.lang.management.ManagementFactory#newPlatformMXBeanProxy
+ ManagementFactory.newPlatformMXBeanProxy}(mbs,
+ ManagementFactory.RUNTIME_MXBEAN_NAME,
+ RuntimeMXBean.class);
+
+
+
+
+
MBeanServerConnection mbs;
// Connect to a running JVM (or itself) and get MBeanServerConnection
@@ -190,7 +154,7 @@
try {
// Assuming the RuntimeMXBean has been registered in mbs
ObjectName oname = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
-
+
// Get standard attribute "VmVendor"
String vendor = (String) mbs.getAttribute(oname, "VmVendor");
} catch (....) {
@@ -198,36 +162,19 @@
// and MBeanServer.getAttribute method
...
}
-
-
-
- MBeanServerConnection mbs;
-
- // Connect to a running JVM (or itself) and get MBeanServerConnection
- // that has the JVM MBeans registered in it
- ...
-
- // Get a MBean proxy for RuntimeMXBean interface
- RuntimeMXBean proxy =
- ManagementFactory.newPlatformMXBeanProxy(mbs,
- ManagementFactory.RUNTIME_MXBEAN_NAME,
- RuntimeMXBean.class);
- // Get standard attribute "VmVendor"
- String vendor = proxy.getVmVendor();
-
Platform Extension
-A Java virtual machine implementation may add its platform extension to
+
- com.sun.management.RuntimeMXBean mxbean =
- (com.sun.management.RuntimeMXBean) ManagementFactory.getRuntimeMXBean();
+1) Direct access to the Oracle-specific MXBean interface
+
+
+ List<com.sun.management.GarbageCollectorMXBean> mxbeans =
+ ManagementFactory.getPlatformMXBeans(com.sun.management.GarbageCollectorMXBean.class);
- // Get the standard attribute "VmVendor"
- String vendor = mxbean.getVmVendor();
+ for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
+ // Get the standard attribute "CollectionCount"
+ String count = mxbean.getCollectionCount();
- // Get the platform-specific attribute "Bar"
- BarType bar = mxbean.getBar();
-
+ // Get the platform-specific attribute "LastGcInfo"
+ GcInfo gcinfo = gc.getLastGcInfo();
+ ...
+ }
MBeanServerConnection mbs;
@@ -268,24 +219,17 @@
// that has the JVM MXBeans registered in it
...
- try {
- // Assuming the RuntimeMXBean has been registered in mbs
- ObjectName oname = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
-
- // Get standard attribute "VmVendor"
- String vendor = (String) mbs.getAttribute(oname, "VmVendor");
+ List<com.sun.management.GarbageCollectorMXBean> mxbeans =
+ ManagementFactory.getPlatformMXBeans(mbs, com.sun.management.GarbageCollectorMXBean.class);
- // Check if this MXBean contains Sun's extension
- if (mbs.isInstanceOf(oname, "com.sun.management.RuntimeMXBean")) {
- // Get platform-specific attribute "Bar"
- BarType bar = (String) mbs.getAttribute(oname, "Bar");
- }
- } catch (....) {
- // Catch the exceptions thrown by ObjectName constructor
- // and MBeanServer methods
+ for (com.sun.management.GarbageCollectorMXBean gc : mxbeans) {
+ // Get the standard attribute "CollectionCount"
+ String count = mxbean.getCollectionCount();
+
+ // Get the platform-specific attribute "LastGcInfo"
+ GcInfo gcinfo = gc.getLastGcInfo();
...
}
-
- * List<BufferPoolMXBean> pools = ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class);
- *
- *
- *
- * java.nio:type=BufferPool,name=pool name
- *
- * where pool name is the {@link #getName name} of the buffer pool.
- *
- * @since 1.7
- */
-
-public interface BufferPoolMXBean extends PlatformManagedObject {
-
- /**
- * Returns the name representing this buffer pool.
- *
- * @return The name of this buffer pool.
- */
- String getName();
-
- /**
- * Returns an estimate of the number of buffers in the pool.
- *
- * @return An estimate of the number of buffers in this pool
- */
- long getCount();
-
- /**
- * Returns an estimate of the total capacity of the buffers in this pool.
- * A buffer's capacity is the number of elements it contains and the value
- * returned by this method is an estimate of the total capacity of buffers
- * in the pool in bytes.
- *
- * @return An estimate of the total capacity of the buffers in this pool
- * in bytes
- */
- long getTotalCapacity();
-
- /**
- * Returns an estimate of the memory that the Java virtual machine is using
- * for this buffer pool. The value returned by this method may differ
- * from the estimate of the total {@link #getTotalCapacity capacity} of
- * the buffers in this pool. This difference is explained by alignment,
- * memory allocator, and other implementation specific reasons.
- *
- * @return An estimate of the memory that the Java virtual machine is using
- * for this buffer pool in bytes, or {@code -1L} if an estimate of
- * the memory usage is not available
- */
- long getMemoryUsed();
-}
diff -r 6679e1339581 -r 799504d1fdcc jdk/src/share/classes/java/util/logging/LogManager.java
--- a/jdk/src/share/classes/java/util/logging/LogManager.java Wed Mar 30 00:59:07 2011 +0100
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java Wed Mar 30 01:00:23 2011 +0100
@@ -1166,7 +1166,12 @@
private static LoggingMXBean loggingMXBean = null;
/**
* String representation of the
- * {@link javax.management.ObjectName} for {@link LoggingMXBean}.
+ * {@link javax.management.ObjectName} for the management interface
+ * for the logging facility.
+ *
+ * @see java.lang.management.PlatformLoggingMXBean
+ * @see java.util.logging.LoggingMXBean
+ *
* @since 1.5
*/
public final static String LOGGING_MXBEAN_NAME
@@ -1174,20 +1179,20 @@
/**
* Returns LoggingMXBean for managing loggers.
- * An alternative way to manage loggers is using
- * the {@link java.lang.management.ManagementFactory#getPlatformMXBeans(Class)
- * ManagementFactory.getPlatformMXBeans} method as follows:
+ * An alternative way to manage loggers is through the
+ * {@link java.lang.management.PlatformLoggingMXBean} interface
+ * that can be obtained by calling:
*
- * List<{@link PlatformLoggingMXBean}> result = ManagementFactory.getPlatformMXBeans(PlatformLoggingMXBean.class);
+ * PlatformLoggingMXBean logging = {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
+ * ManagementFactory.getPlatformMXBean}(PlatformLoggingMXBean.class);
*
*
* @return a {@link LoggingMXBean} object.
*
- * @see PlatformLoggingMXBean
- * @see java.lang.management.ManagementFactory
+ * @see java.lang.management.PlatformLoggingMXBean
* @since 1.5
*/
- public static synchronized LoggingMXBean getLoggingMXBean() {
+ public static synchronized LoggingMXBean getLoggingMXBean() {
if (loggingMXBean == null) {
loggingMXBean = new Logging();
}
diff -r 6679e1339581 -r 799504d1fdcc jdk/src/share/classes/java/util/logging/LoggingMXBean.java
--- a/jdk/src/share/classes/java/util/logging/LoggingMXBean.java Wed Mar 30 00:59:07 2011 +0100
+++ b/jdk/src/share/classes/java/util/logging/LoggingMXBean.java Wed Mar 30 01:00:23 2011 +0100
@@ -27,36 +27,41 @@
/**
- * The management interface for the logging facility.
+ * The management interface for the logging facility. It is recommended
+ * to use the {@link java.lang.management.PlatformLoggingMXBean} management
+ * interface that implements all attributes defined in this
+ * {@code LoggingMXBean}. The
+ * {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
+ * ManagementFactory.getPlatformMXBean} method can be used to obtain
+ * the {@code PlatformLoggingMXBean} object representing the management
+ * interface for logging.
*
*
- * {@link LogManager#LOGGING_MXBEAN_NAME
- * java.util.logging:type=Logging}
- *
- *
- * The instance registered in the platform MBeanServer with
- * this {@code ObjectName} is also a {@link PlatformLoggingMXBean}.
+ *
+ * {@link LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging}
+ *
+ *
- * ManagementFactory.getPlatformMXBeans(PlatformLoggingMXBean.class);
- *
- * or from the {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
- * platform MBeanServer}.
- *
- * The {@link javax.management.ObjectName ObjectName} for uniquely
- * identifying the LoggingMXBean within an MBeanServer is:
- *
- * java.util.logging:type=Logging
- *
- *
- * The {@link PlatformManagedObject#getObjectName} method
- * can be used to obtain its {@code ObjectName}.
- *
- * @see java.lang.management.PlatformManagedObject
- *
- * @author Mandy Chung
- * @since 1.7
- */
-public interface PlatformLoggingMXBean extends LoggingMXBean, PlatformManagedObject {
-}
diff -r 6679e1339581 -r 799504d1fdcc jdk/src/share/classes/java/util/logging/SimpleFormatter.java
--- a/jdk/src/share/classes/java/util/logging/SimpleFormatter.java Wed Mar 30 00:59:07 2011 +0100
+++ b/jdk/src/share/classes/java/util/logging/SimpleFormatter.java Wed Mar 30 01:00:23 2011 +0100
@@ -29,31 +29,108 @@
import java.io.*;
import java.text.*;
import java.util.Date;
+import sun.util.logging.LoggingSupport;
/**
- * Print a brief summary of the LogRecord in a human readable
+ * Print a brief summary of the {@code LogRecord} in a human readable
* format. The summary will typically be 1 or 2 lines.
*
+ *
+ * {@link String#format String.format}(format, date, source, logger, level, message, thrown);
+ *
+ * where the arguments are:
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * WARNING: warning message [Tue Mar 22 13:11:31 PDT 2011]
+ *
+ * Tue Mar 22 13:11:31 PDT 2011 MyClass fatal
+ * SEVERE: several message with an exception
+ * java.lang.IllegalArgumentException: invalid argument
+ * at MyClass.mash(MyClass.java:9)
+ * at MyClass.crunch(MyClass.java:6)
+ * at MyClass.main(MyClass.java:3)
+ *
+ * Mar 22, 2011 1:11:31 PM MyClass fatal
+ * SEVERE: several message with an exception
+ *