< prev index next >

test/sun/util/logging/SourceClassName.java

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug     6985460
  27  * @summary Test the source class name and method output by the platform
  28  *          logger.
  29  *

  30  * @compile -XDignore.symbol.file SourceClassName.java
  31  * @run main/othervm SourceClassName
  32  */
  33 
  34 import java.util.logging.*;
  35 import java.io.*;
  36 import sun.util.logging.PlatformLogger;
  37 
  38 public class SourceClassName {
  39     public static void main(String[] args) throws Exception {
  40         File dir = new File(System.getProperty("user.dir", "."));
  41         File log = new File(dir, "testlog.txt");
  42         PrintStream logps = new PrintStream(log);
  43         writeLogRecords(logps);
  44         checkLogRecords(log);
  45     }
  46 
  47     private static void writeLogRecords(PrintStream logps) throws Exception {
  48         PrintStream err = System.err;
  49         try {




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug     6985460
  27  * @summary Test the source class name and method output by the platform
  28  *          logger.
  29  *
  30  * @modules java.base/sun.util.logging
  31  * @compile -XDignore.symbol.file SourceClassName.java
  32  * @run main/othervm SourceClassName
  33  */
  34 
  35 import java.util.logging.*;
  36 import java.io.*;
  37 import sun.util.logging.PlatformLogger;
  38 
  39 public class SourceClassName {
  40     public static void main(String[] args) throws Exception {
  41         File dir = new File(System.getProperty("user.dir", "."));
  42         File log = new File(dir, "testlog.txt");
  43         PrintStream logps = new PrintStream(log);
  44         writeLogRecords(logps);
  45         checkLogRecords(log);
  46     }
  47 
  48     private static void writeLogRecords(PrintStream logps) throws Exception {
  49         PrintStream err = System.err;
  50         try {


< prev index next >