< prev index next >

src/java.logging/share/classes/java/util/logging/LogRecord.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.util.logging;
  27 import java.time.Instant;
  28 import java.util.*;
  29 import java.util.concurrent.atomic.AtomicInteger;
  30 import java.util.concurrent.atomic.AtomicLong;
  31 import java.io.*;
  32 import java.security.AccessController;
  33 import java.security.PrivilegedAction;
  34 import java.time.Clock;
  35 import java.util.function.Predicate;
  36 
  37 import static jdk.internal.logger.SimpleConsoleLogger.isFilteredFrame;
  38 
  39 /**
  40  * LogRecord objects are used to pass logging requests between
  41  * the logging framework and individual log Handlers.
  42  * <p>
  43  * When a LogRecord is passed into the logging framework it
  44  * logically belongs to the framework and should no longer be
  45  * used or updated by the client application.
  46  * <p>
  47  * Note that if the client application has not specified an
  48  * explicit source method name and source class name, then the
  49  * LogRecord class will infer them automatically when they are
  50  * first accessed (due to a call on getSourceMethodName or
  51  * getSourceClassName) by analyzing the call stack.  Therefore,
  52  * if a logging Handler wants to pass off a LogRecord to another
  53  * thread, or to transmit it over RMI, and if it wishes to subsequently
  54  * obtain method name or class name information it should call
  55  * one of getSourceClassName or getSourceMethodName to force
  56  * the values to be filled in.
  57  * <p>


   1 /*
   2  * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.util.logging;
  27 import java.time.Instant;
  28 import java.util.*;
  29 import java.util.concurrent.atomic.AtomicInteger;
  30 import java.util.concurrent.atomic.AtomicLong;
  31 import java.io.*;
  32 import java.security.AccessController;
  33 import java.security.PrivilegedAction;
  34 import java.time.Clock;
  35 import java.util.function.Predicate;
  36 import static jdk.internal.logger.SurrogateLogger.isFilteredFrame;

  37 
  38 /**
  39  * LogRecord objects are used to pass logging requests between
  40  * the logging framework and individual log Handlers.
  41  * <p>
  42  * When a LogRecord is passed into the logging framework it
  43  * logically belongs to the framework and should no longer be
  44  * used or updated by the client application.
  45  * <p>
  46  * Note that if the client application has not specified an
  47  * explicit source method name and source class name, then the
  48  * LogRecord class will infer them automatically when they are
  49  * first accessed (due to a call on getSourceMethodName or
  50  * getSourceClassName) by analyzing the call stack.  Therefore,
  51  * if a logging Handler wants to pass off a LogRecord to another
  52  * thread, or to transmit it over RMI, and if it wishes to subsequently
  53  * obtain method name or class name information it should call
  54  * one of getSourceClassName or getSourceMethodName to force
  55  * the values to be filled in.
  56  * <p>


< prev index next >