equal
deleted
inserted
replaced
336 * in products) should create and use their own Logger objects, |
336 * in products) should create and use their own Logger objects, |
337 * with appropriate names, so that logging can be controlled on a |
337 * with appropriate names, so that logging can be controlled on a |
338 * suitable per-Logger granularity. Developers also need to keep a |
338 * suitable per-Logger granularity. Developers also need to keep a |
339 * strong reference to their Logger objects to prevent them from |
339 * strong reference to their Logger objects to prevent them from |
340 * being garbage collected. |
340 * being garbage collected. |
341 * <p> |
341 * |
342 * @deprecated Initialization of this field is prone to deadlocks. |
342 * @deprecated Initialization of this field is prone to deadlocks. |
343 * The field must be initialized by the Logger class initialization |
343 * The field must be initialized by the Logger class initialization |
344 * which may cause deadlocks with the LogManager class initialization. |
344 * which may cause deadlocks with the LogManager class initialization. |
345 * In such cases two class initialization wait for each other to complete. |
345 * In such cases two class initialization wait for each other to complete. |
346 * The preferred way to get the global logger object is via the call |
346 * The preferred way to get the global logger object is via the call |
524 * If the named Logger already exists and does not yet have a |
524 * If the named Logger already exists and does not yet have a |
525 * localization resource bundle then the given resource bundle |
525 * localization resource bundle then the given resource bundle |
526 * name is used. If the named Logger already exists and has |
526 * name is used. If the named Logger already exists and has |
527 * a different resource bundle name then an IllegalArgumentException |
527 * a different resource bundle name then an IllegalArgumentException |
528 * is thrown. |
528 * is thrown. |
529 * <p> |
529 * |
530 * @param name A name for the logger. This should |
530 * @param name A name for the logger. This should |
531 * be a dot-separated name and should normally |
531 * be a dot-separated name and should normally |
532 * be based on the package name or class name |
532 * be based on the package name or class name |
533 * of the subsystem, such as java.net |
533 * of the subsystem, such as java.net |
534 * or javax.swing |
534 * or javax.swing |
593 * to have the root logger ("") as its parent. This means that |
593 * to have the root logger ("") as its parent. This means that |
594 * by default it inherits its effective level and handlers |
594 * by default it inherits its effective level and handlers |
595 * from the root logger. Changing its parent via the |
595 * from the root logger. Changing its parent via the |
596 * {@link #setParent(java.util.logging.Logger) setParent} method |
596 * {@link #setParent(java.util.logging.Logger) setParent} method |
597 * will still require the security permission specified by that method. |
597 * will still require the security permission specified by that method. |
598 * <p> |
|
599 * |
598 * |
600 * @return a newly created private Logger |
599 * @return a newly created private Logger |
601 */ |
600 */ |
602 public static Logger getAnonymousLogger() { |
601 public static Logger getAnonymousLogger() { |
603 return getAnonymousLogger(null); |
602 return getAnonymousLogger(null); |
619 * to have the root logger ("") as its parent. This means that |
618 * to have the root logger ("") as its parent. This means that |
620 * by default it inherits its effective level and handlers |
619 * by default it inherits its effective level and handlers |
621 * from the root logger. Changing its parent via the |
620 * from the root logger. Changing its parent via the |
622 * {@link #setParent(java.util.logging.Logger) setParent} method |
621 * {@link #setParent(java.util.logging.Logger) setParent} method |
623 * will still require the security permission specified by that method. |
622 * will still require the security permission specified by that method. |
624 * <p> |
623 * |
625 * @param resourceBundleName name of ResourceBundle to be used for localizing |
624 * @param resourceBundleName name of ResourceBundle to be used for localizing |
626 * messages for this logger. |
625 * messages for this logger. |
627 * May be null if none of the messages require localization. |
626 * May be null if none of the messages require localization. |
628 * @return a newly created private Logger |
627 * @return a newly created private Logger |
629 * @throws MissingResourceException if the resourceBundleName is non-null and |
628 * @throws MissingResourceException if the resourceBundleName is non-null and |
774 * Log a message, with no arguments. |
773 * Log a message, with no arguments. |
775 * <p> |
774 * <p> |
776 * If the logger is currently enabled for the given message |
775 * If the logger is currently enabled for the given message |
777 * level then the given message is forwarded to all the |
776 * level then the given message is forwarded to all the |
778 * registered output Handler objects. |
777 * registered output Handler objects. |
779 * <p> |
778 * |
780 * @param level One of the message level identifiers, e.g., SEVERE |
779 * @param level One of the message level identifiers, e.g., SEVERE |
781 * @param msg The string message (or a key in the message catalog) |
780 * @param msg The string message (or a key in the message catalog) |
782 */ |
781 */ |
783 public void log(Level level, String msg) { |
782 public void log(Level level, String msg) { |
784 if (!isLoggable(level)) { |
783 if (!isLoggable(level)) { |
794 * <p> |
793 * <p> |
795 * If the logger is currently enabled for the given message |
794 * If the logger is currently enabled for the given message |
796 * level then the message is constructed by invoking the provided |
795 * level then the message is constructed by invoking the provided |
797 * supplier function and forwarded to all the registered output |
796 * supplier function and forwarded to all the registered output |
798 * Handler objects. |
797 * Handler objects. |
799 * <p> |
798 * |
800 * @param level One of the message level identifiers, e.g., SEVERE |
799 * @param level One of the message level identifiers, e.g., SEVERE |
801 * @param msgSupplier A function, which when called, produces the |
800 * @param msgSupplier A function, which when called, produces the |
802 * desired log message |
801 * desired log message |
803 */ |
802 */ |
804 public void log(Level level, Supplier<String> msgSupplier) { |
803 public void log(Level level, Supplier<String> msgSupplier) { |
813 * Log a message, with one object parameter. |
812 * Log a message, with one object parameter. |
814 * <p> |
813 * <p> |
815 * If the logger is currently enabled for the given message |
814 * If the logger is currently enabled for the given message |
816 * level then a corresponding LogRecord is created and forwarded |
815 * level then a corresponding LogRecord is created and forwarded |
817 * to all the registered output Handler objects. |
816 * to all the registered output Handler objects. |
818 * <p> |
817 * |
819 * @param level One of the message level identifiers, e.g., SEVERE |
818 * @param level One of the message level identifiers, e.g., SEVERE |
820 * @param msg The string message (or a key in the message catalog) |
819 * @param msg The string message (or a key in the message catalog) |
821 * @param param1 parameter to the message |
820 * @param param1 parameter to the message |
822 */ |
821 */ |
823 public void log(Level level, String msg, Object param1) { |
822 public void log(Level level, String msg, Object param1) { |
834 * Log a message, with an array of object arguments. |
833 * Log a message, with an array of object arguments. |
835 * <p> |
834 * <p> |
836 * If the logger is currently enabled for the given message |
835 * If the logger is currently enabled for the given message |
837 * level then a corresponding LogRecord is created and forwarded |
836 * level then a corresponding LogRecord is created and forwarded |
838 * to all the registered output Handler objects. |
837 * to all the registered output Handler objects. |
839 * <p> |
838 * |
840 * @param level One of the message level identifiers, e.g., SEVERE |
839 * @param level One of the message level identifiers, e.g., SEVERE |
841 * @param msg The string message (or a key in the message catalog) |
840 * @param msg The string message (or a key in the message catalog) |
842 * @param params array of parameters to the message |
841 * @param params array of parameters to the message |
843 */ |
842 */ |
844 public void log(Level level, String msg, Object params[]) { |
843 public void log(Level level, String msg, Object params[]) { |
859 * <p> |
858 * <p> |
860 * Note that the thrown argument is stored in the LogRecord thrown |
859 * Note that the thrown argument is stored in the LogRecord thrown |
861 * property, rather than the LogRecord parameters property. Thus it is |
860 * property, rather than the LogRecord parameters property. Thus it is |
862 * processed specially by output Formatters and is not treated |
861 * processed specially by output Formatters and is not treated |
863 * as a formatting parameter to the LogRecord message property. |
862 * as a formatting parameter to the LogRecord message property. |
864 * <p> |
863 * |
865 * @param level One of the message level identifiers, e.g., SEVERE |
864 * @param level One of the message level identifiers, e.g., SEVERE |
866 * @param msg The string message (or a key in the message catalog) |
865 * @param msg The string message (or a key in the message catalog) |
867 * @param thrown Throwable associated with log message. |
866 * @param thrown Throwable associated with log message. |
868 */ |
867 */ |
869 public void log(Level level, String msg, Throwable thrown) { |
868 public void log(Level level, String msg, Throwable thrown) { |
885 * <p> |
884 * <p> |
886 * Note that the thrown argument is stored in the LogRecord thrown |
885 * Note that the thrown argument is stored in the LogRecord thrown |
887 * property, rather than the LogRecord parameters property. Thus it is |
886 * property, rather than the LogRecord parameters property. Thus it is |
888 * processed specially by output Formatters and is not treated |
887 * processed specially by output Formatters and is not treated |
889 * as a formatting parameter to the LogRecord message property. |
888 * as a formatting parameter to the LogRecord message property. |
890 * <p> |
889 * |
891 * @param level One of the message level identifiers, e.g., SEVERE |
890 * @param level One of the message level identifiers, e.g., SEVERE |
892 * @param thrown Throwable associated with log message. |
891 * @param thrown Throwable associated with log message. |
893 * @param msgSupplier A function, which when called, produces the |
892 * @param msgSupplier A function, which when called, produces the |
894 * desired log message |
893 * desired log message |
895 * @since 1.8 |
894 * @since 1.8 |
912 * with no arguments. |
911 * with no arguments. |
913 * <p> |
912 * <p> |
914 * If the logger is currently enabled for the given message |
913 * If the logger is currently enabled for the given message |
915 * level then the given message is forwarded to all the |
914 * level then the given message is forwarded to all the |
916 * registered output Handler objects. |
915 * registered output Handler objects. |
917 * <p> |
916 * |
918 * @param level One of the message level identifiers, e.g., SEVERE |
917 * @param level One of the message level identifiers, e.g., SEVERE |
919 * @param sourceClass name of class that issued the logging request |
918 * @param sourceClass name of class that issued the logging request |
920 * @param sourceMethod name of method that issued the logging request |
919 * @param sourceMethod name of method that issued the logging request |
921 * @param msg The string message (or a key in the message catalog) |
920 * @param msg The string message (or a key in the message catalog) |
922 */ |
921 */ |
936 * <p> |
935 * <p> |
937 * If the logger is currently enabled for the given message |
936 * If the logger is currently enabled for the given message |
938 * level then the message is constructed by invoking the provided |
937 * level then the message is constructed by invoking the provided |
939 * supplier function and forwarded to all the registered output |
938 * supplier function and forwarded to all the registered output |
940 * Handler objects. |
939 * Handler objects. |
941 * <p> |
940 * |
942 * @param level One of the message level identifiers, e.g., SEVERE |
941 * @param level One of the message level identifiers, e.g., SEVERE |
943 * @param sourceClass name of class that issued the logging request |
942 * @param sourceClass name of class that issued the logging request |
944 * @param sourceMethod name of method that issued the logging request |
943 * @param sourceMethod name of method that issued the logging request |
945 * @param msgSupplier A function, which when called, produces the |
944 * @param msgSupplier A function, which when called, produces the |
946 * desired log message |
945 * desired log message |
962 * with a single object parameter to the log message. |
961 * with a single object parameter to the log message. |
963 * <p> |
962 * <p> |
964 * If the logger is currently enabled for the given message |
963 * If the logger is currently enabled for the given message |
965 * level then a corresponding LogRecord is created and forwarded |
964 * level then a corresponding LogRecord is created and forwarded |
966 * to all the registered output Handler objects. |
965 * to all the registered output Handler objects. |
967 * <p> |
966 * |
968 * @param level One of the message level identifiers, e.g., SEVERE |
967 * @param level One of the message level identifiers, e.g., SEVERE |
969 * @param sourceClass name of class that issued the logging request |
968 * @param sourceClass name of class that issued the logging request |
970 * @param sourceMethod name of method that issued the logging request |
969 * @param sourceMethod name of method that issued the logging request |
971 * @param msg The string message (or a key in the message catalog) |
970 * @param msg The string message (or a key in the message catalog) |
972 * @param param1 Parameter to the log message. |
971 * @param param1 Parameter to the log message. |
989 * with an array of object arguments. |
988 * with an array of object arguments. |
990 * <p> |
989 * <p> |
991 * If the logger is currently enabled for the given message |
990 * If the logger is currently enabled for the given message |
992 * level then a corresponding LogRecord is created and forwarded |
991 * level then a corresponding LogRecord is created and forwarded |
993 * to all the registered output Handler objects. |
992 * to all the registered output Handler objects. |
994 * <p> |
993 * |
995 * @param level One of the message level identifiers, e.g., SEVERE |
994 * @param level One of the message level identifiers, e.g., SEVERE |
996 * @param sourceClass name of class that issued the logging request |
995 * @param sourceClass name of class that issued the logging request |
997 * @param sourceMethod name of method that issued the logging request |
996 * @param sourceMethod name of method that issued the logging request |
998 * @param msg The string message (or a key in the message catalog) |
997 * @param msg The string message (or a key in the message catalog) |
999 * @param params Array of parameters to the message |
998 * @param params Array of parameters to the message |
1020 * <p> |
1019 * <p> |
1021 * Note that the thrown argument is stored in the LogRecord thrown |
1020 * Note that the thrown argument is stored in the LogRecord thrown |
1022 * property, rather than the LogRecord parameters property. Thus it is |
1021 * property, rather than the LogRecord parameters property. Thus it is |
1023 * processed specially by output Formatters and is not treated |
1022 * processed specially by output Formatters and is not treated |
1024 * as a formatting parameter to the LogRecord message property. |
1023 * as a formatting parameter to the LogRecord message property. |
1025 * <p> |
1024 * |
1026 * @param level One of the message level identifiers, e.g., SEVERE |
1025 * @param level One of the message level identifiers, e.g., SEVERE |
1027 * @param sourceClass name of class that issued the logging request |
1026 * @param sourceClass name of class that issued the logging request |
1028 * @param sourceMethod name of method that issued the logging request |
1027 * @param sourceMethod name of method that issued the logging request |
1029 * @param msg The string message (or a key in the message catalog) |
1028 * @param msg The string message (or a key in the message catalog) |
1030 * @param thrown Throwable associated with log message. |
1029 * @param thrown Throwable associated with log message. |
1052 * <p> |
1051 * <p> |
1053 * Note that the thrown argument is stored in the LogRecord thrown |
1052 * Note that the thrown argument is stored in the LogRecord thrown |
1054 * property, rather than the LogRecord parameters property. Thus it is |
1053 * property, rather than the LogRecord parameters property. Thus it is |
1055 * processed specially by output Formatters and is not treated |
1054 * processed specially by output Formatters and is not treated |
1056 * as a formatting parameter to the LogRecord message property. |
1055 * as a formatting parameter to the LogRecord message property. |
1057 * <p> |
1056 * |
1058 * @param level One of the message level identifiers, e.g., SEVERE |
1057 * @param level One of the message level identifiers, e.g., SEVERE |
1059 * @param sourceClass name of class that issued the logging request |
1058 * @param sourceClass name of class that issued the logging request |
1060 * @param sourceMethod name of method that issued the logging request |
1059 * @param sourceMethod name of method that issued the logging request |
1061 * @param thrown Throwable associated with log message. |
1060 * @param thrown Throwable associated with log message. |
1062 * @param msgSupplier A function, which when called, produces the |
1061 * @param msgSupplier A function, which when called, produces the |
1111 * registered output Handler objects. |
1110 * registered output Handler objects. |
1112 * <p> |
1111 * <p> |
1113 * The msg string is localized using the named resource bundle. If the |
1112 * The msg string is localized using the named resource bundle. If the |
1114 * resource bundle name is null, or an empty String or invalid |
1113 * resource bundle name is null, or an empty String or invalid |
1115 * then the msg string is not localized. |
1114 * then the msg string is not localized. |
1116 * <p> |
1115 * |
1117 * @param level One of the message level identifiers, e.g., SEVERE |
1116 * @param level One of the message level identifiers, e.g., SEVERE |
1118 * @param sourceClass name of class that issued the logging request |
1117 * @param sourceClass name of class that issued the logging request |
1119 * @param sourceMethod name of method that issued the logging request |
1118 * @param sourceMethod name of method that issued the logging request |
1120 * @param bundleName name of resource bundle to localize msg, |
1119 * @param bundleName name of resource bundle to localize msg, |
1121 * can be null |
1120 * can be null |
1145 * to all the registered output Handler objects. |
1144 * to all the registered output Handler objects. |
1146 * <p> |
1145 * <p> |
1147 * The msg string is localized using the named resource bundle. If the |
1146 * The msg string is localized using the named resource bundle. If the |
1148 * resource bundle name is null, or an empty String or invalid |
1147 * resource bundle name is null, or an empty String or invalid |
1149 * then the msg string is not localized. |
1148 * then the msg string is not localized. |
1150 * <p> |
1149 * |
1151 * @param level One of the message level identifiers, e.g., SEVERE |
1150 * @param level One of the message level identifiers, e.g., SEVERE |
1152 * @param sourceClass name of class that issued the logging request |
1151 * @param sourceClass name of class that issued the logging request |
1153 * @param sourceMethod name of method that issued the logging request |
1152 * @param sourceMethod name of method that issued the logging request |
1154 * @param bundleName name of resource bundle to localize msg, |
1153 * @param bundleName name of resource bundle to localize msg, |
1155 * can be null |
1154 * can be null |
1182 * to all the registered output Handler objects. |
1181 * to all the registered output Handler objects. |
1183 * <p> |
1182 * <p> |
1184 * The msg string is localized using the named resource bundle. If the |
1183 * The msg string is localized using the named resource bundle. If the |
1185 * resource bundle name is null, or an empty String or invalid |
1184 * resource bundle name is null, or an empty String or invalid |
1186 * then the msg string is not localized. |
1185 * then the msg string is not localized. |
1187 * <p> |
1186 * |
1188 * @param level One of the message level identifiers, e.g., SEVERE |
1187 * @param level One of the message level identifiers, e.g., SEVERE |
1189 * @param sourceClass name of class that issued the logging request |
1188 * @param sourceClass name of class that issued the logging request |
1190 * @param sourceMethod name of method that issued the logging request |
1189 * @param sourceMethod name of method that issued the logging request |
1191 * @param bundleName name of resource bundle to localize msg, |
1190 * @param bundleName name of resource bundle to localize msg, |
1192 * can be null. |
1191 * can be null. |
1218 * to all the registered output Handler objects. |
1217 * to all the registered output Handler objects. |
1219 * <p> |
1218 * <p> |
1220 * The {@code msg} string is localized using the given resource bundle. |
1219 * The {@code msg} string is localized using the given resource bundle. |
1221 * If the resource bundle is {@code null}, then the {@code msg} string is not |
1220 * If the resource bundle is {@code null}, then the {@code msg} string is not |
1222 * localized. |
1221 * localized. |
1223 * <p> |
1222 * |
1224 * @param level One of the message level identifiers, e.g., SEVERE |
1223 * @param level One of the message level identifiers, e.g., SEVERE |
1225 * @param sourceClass Name of the class that issued the logging request |
1224 * @param sourceClass Name of the class that issued the logging request |
1226 * @param sourceMethod Name of the method that issued the logging request |
1225 * @param sourceMethod Name of the method that issued the logging request |
1227 * @param bundle Resource bundle to localize {@code msg}, |
1226 * @param bundle Resource bundle to localize {@code msg}, |
1228 * can be {@code null}. |
1227 * can be {@code null}. |
1258 * <p> |
1257 * <p> |
1259 * Note that the thrown argument is stored in the LogRecord thrown |
1258 * Note that the thrown argument is stored in the LogRecord thrown |
1260 * property, rather than the LogRecord parameters property. Thus it is |
1259 * property, rather than the LogRecord parameters property. Thus it is |
1261 * processed specially by output Formatters and is not treated |
1260 * processed specially by output Formatters and is not treated |
1262 * as a formatting parameter to the LogRecord message property. |
1261 * as a formatting parameter to the LogRecord message property. |
1263 * <p> |
1262 * |
1264 * @param level One of the message level identifiers, e.g., SEVERE |
1263 * @param level One of the message level identifiers, e.g., SEVERE |
1265 * @param sourceClass name of class that issued the logging request |
1264 * @param sourceClass name of class that issued the logging request |
1266 * @param sourceMethod name of method that issued the logging request |
1265 * @param sourceMethod name of method that issued the logging request |
1267 * @param bundleName name of resource bundle to localize msg, |
1266 * @param bundleName name of resource bundle to localize msg, |
1268 * can be null |
1267 * can be null |
1299 * <p> |
1298 * <p> |
1300 * Note that the thrown argument is stored in the LogRecord thrown |
1299 * Note that the thrown argument is stored in the LogRecord thrown |
1301 * property, rather than the LogRecord parameters property. Thus it is |
1300 * property, rather than the LogRecord parameters property. Thus it is |
1302 * processed specially by output Formatters and is not treated |
1301 * processed specially by output Formatters and is not treated |
1303 * as a formatting parameter to the LogRecord message property. |
1302 * as a formatting parameter to the LogRecord message property. |
1304 * <p> |
1303 * |
1305 * @param level One of the message level identifiers, e.g., SEVERE |
1304 * @param level One of the message level identifiers, e.g., SEVERE |
1306 * @param sourceClass Name of the class that issued the logging request |
1305 * @param sourceClass Name of the class that issued the logging request |
1307 * @param sourceMethod Name of the method that issued the logging request |
1306 * @param sourceMethod Name of the method that issued the logging request |
1308 * @param bundle Resource bundle to localize {@code msg}, |
1307 * @param bundle Resource bundle to localize {@code msg}, |
1309 * can be {@code null} |
1308 * can be {@code null} |
1331 * Log a method entry. |
1330 * Log a method entry. |
1332 * <p> |
1331 * <p> |
1333 * This is a convenience method that can be used to log entry |
1332 * This is a convenience method that can be used to log entry |
1334 * to a method. A LogRecord with message "ENTRY", log level |
1333 * to a method. A LogRecord with message "ENTRY", log level |
1335 * FINER, and the given sourceMethod and sourceClass is logged. |
1334 * FINER, and the given sourceMethod and sourceClass is logged. |
1336 * <p> |
1335 * |
1337 * @param sourceClass name of class that issued the logging request |
1336 * @param sourceClass name of class that issued the logging request |
1338 * @param sourceMethod name of method that is being entered |
1337 * @param sourceMethod name of method that is being entered |
1339 */ |
1338 */ |
1340 public void entering(String sourceClass, String sourceMethod) { |
1339 public void entering(String sourceClass, String sourceMethod) { |
1341 logp(Level.FINER, sourceClass, sourceMethod, "ENTRY"); |
1340 logp(Level.FINER, sourceClass, sourceMethod, "ENTRY"); |
1346 * <p> |
1345 * <p> |
1347 * This is a convenience method that can be used to log entry |
1346 * This is a convenience method that can be used to log entry |
1348 * to a method. A LogRecord with message "ENTRY {0}", log level |
1347 * to a method. A LogRecord with message "ENTRY {0}", log level |
1349 * FINER, and the given sourceMethod, sourceClass, and parameter |
1348 * FINER, and the given sourceMethod, sourceClass, and parameter |
1350 * is logged. |
1349 * is logged. |
1351 * <p> |
1350 * |
1352 * @param sourceClass name of class that issued the logging request |
1351 * @param sourceClass name of class that issued the logging request |
1353 * @param sourceMethod name of method that is being entered |
1352 * @param sourceMethod name of method that is being entered |
1354 * @param param1 parameter to the method being entered |
1353 * @param param1 parameter to the method being entered |
1355 */ |
1354 */ |
1356 public void entering(String sourceClass, String sourceMethod, Object param1) { |
1355 public void entering(String sourceClass, String sourceMethod, Object param1) { |
1363 * This is a convenience method that can be used to log entry |
1362 * This is a convenience method that can be used to log entry |
1364 * to a method. A LogRecord with message "ENTRY" (followed by a |
1363 * to a method. A LogRecord with message "ENTRY" (followed by a |
1365 * format {N} indicator for each entry in the parameter array), |
1364 * format {N} indicator for each entry in the parameter array), |
1366 * log level FINER, and the given sourceMethod, sourceClass, and |
1365 * log level FINER, and the given sourceMethod, sourceClass, and |
1367 * parameters is logged. |
1366 * parameters is logged. |
1368 * <p> |
1367 * |
1369 * @param sourceClass name of class that issued the logging request |
1368 * @param sourceClass name of class that issued the logging request |
1370 * @param sourceMethod name of method that is being entered |
1369 * @param sourceMethod name of method that is being entered |
1371 * @param params array of parameters to the method being entered |
1370 * @param params array of parameters to the method being entered |
1372 */ |
1371 */ |
1373 public void entering(String sourceClass, String sourceMethod, Object params[]) { |
1372 public void entering(String sourceClass, String sourceMethod, Object params[]) { |
1387 * Log a method return. |
1386 * Log a method return. |
1388 * <p> |
1387 * <p> |
1389 * This is a convenience method that can be used to log returning |
1388 * This is a convenience method that can be used to log returning |
1390 * from a method. A LogRecord with message "RETURN", log level |
1389 * from a method. A LogRecord with message "RETURN", log level |
1391 * FINER, and the given sourceMethod and sourceClass is logged. |
1390 * FINER, and the given sourceMethod and sourceClass is logged. |
1392 * <p> |
1391 * |
1393 * @param sourceClass name of class that issued the logging request |
1392 * @param sourceClass name of class that issued the logging request |
1394 * @param sourceMethod name of the method |
1393 * @param sourceMethod name of the method |
1395 */ |
1394 */ |
1396 public void exiting(String sourceClass, String sourceMethod) { |
1395 public void exiting(String sourceClass, String sourceMethod) { |
1397 logp(Level.FINER, sourceClass, sourceMethod, "RETURN"); |
1396 logp(Level.FINER, sourceClass, sourceMethod, "RETURN"); |
1403 * <p> |
1402 * <p> |
1404 * This is a convenience method that can be used to log returning |
1403 * This is a convenience method that can be used to log returning |
1405 * from a method. A LogRecord with message "RETURN {0}", log level |
1404 * from a method. A LogRecord with message "RETURN {0}", log level |
1406 * FINER, and the gives sourceMethod, sourceClass, and result |
1405 * FINER, and the gives sourceMethod, sourceClass, and result |
1407 * object is logged. |
1406 * object is logged. |
1408 * <p> |
1407 * |
1409 * @param sourceClass name of class that issued the logging request |
1408 * @param sourceClass name of class that issued the logging request |
1410 * @param sourceMethod name of the method |
1409 * @param sourceMethod name of the method |
1411 * @param result Object that is being returned |
1410 * @param result Object that is being returned |
1412 */ |
1411 */ |
1413 public void exiting(String sourceClass, String sourceMethod, Object result) { |
1412 public void exiting(String sourceClass, String sourceMethod, Object result) { |
1428 * <p> |
1427 * <p> |
1429 * Note that the thrown argument is stored in the LogRecord thrown |
1428 * Note that the thrown argument is stored in the LogRecord thrown |
1430 * property, rather than the LogRecord parameters property. Thus it is |
1429 * property, rather than the LogRecord parameters property. Thus it is |
1431 * processed specially by output Formatters and is not treated |
1430 * processed specially by output Formatters and is not treated |
1432 * as a formatting parameter to the LogRecord message property. |
1431 * as a formatting parameter to the LogRecord message property. |
1433 * <p> |
1432 * |
1434 * @param sourceClass name of class that issued the logging request |
1433 * @param sourceClass name of class that issued the logging request |
1435 * @param sourceMethod name of the method. |
1434 * @param sourceMethod name of the method. |
1436 * @param thrown The Throwable that is being thrown. |
1435 * @param thrown The Throwable that is being thrown. |
1437 */ |
1436 */ |
1438 public void throwing(String sourceClass, String sourceMethod, Throwable thrown) { |
1437 public void throwing(String sourceClass, String sourceMethod, Throwable thrown) { |
1454 * Log a SEVERE message. |
1453 * Log a SEVERE message. |
1455 * <p> |
1454 * <p> |
1456 * If the logger is currently enabled for the SEVERE message |
1455 * If the logger is currently enabled for the SEVERE message |
1457 * level then the given message is forwarded to all the |
1456 * level then the given message is forwarded to all the |
1458 * registered output Handler objects. |
1457 * registered output Handler objects. |
1459 * <p> |
1458 * |
1460 * @param msg The string message (or a key in the message catalog) |
1459 * @param msg The string message (or a key in the message catalog) |
1461 */ |
1460 */ |
1462 public void severe(String msg) { |
1461 public void severe(String msg) { |
1463 log(Level.SEVERE, msg); |
1462 log(Level.SEVERE, msg); |
1464 } |
1463 } |
1467 * Log a WARNING message. |
1466 * Log a WARNING message. |
1468 * <p> |
1467 * <p> |
1469 * If the logger is currently enabled for the WARNING message |
1468 * If the logger is currently enabled for the WARNING message |
1470 * level then the given message is forwarded to all the |
1469 * level then the given message is forwarded to all the |
1471 * registered output Handler objects. |
1470 * registered output Handler objects. |
1472 * <p> |
1471 * |
1473 * @param msg The string message (or a key in the message catalog) |
1472 * @param msg The string message (or a key in the message catalog) |
1474 */ |
1473 */ |
1475 public void warning(String msg) { |
1474 public void warning(String msg) { |
1476 log(Level.WARNING, msg); |
1475 log(Level.WARNING, msg); |
1477 } |
1476 } |
1480 * Log an INFO message. |
1479 * Log an INFO message. |
1481 * <p> |
1480 * <p> |
1482 * If the logger is currently enabled for the INFO message |
1481 * If the logger is currently enabled for the INFO message |
1483 * level then the given message is forwarded to all the |
1482 * level then the given message is forwarded to all the |
1484 * registered output Handler objects. |
1483 * registered output Handler objects. |
1485 * <p> |
1484 * |
1486 * @param msg The string message (or a key in the message catalog) |
1485 * @param msg The string message (or a key in the message catalog) |
1487 */ |
1486 */ |
1488 public void info(String msg) { |
1487 public void info(String msg) { |
1489 log(Level.INFO, msg); |
1488 log(Level.INFO, msg); |
1490 } |
1489 } |
1493 * Log a CONFIG message. |
1492 * Log a CONFIG message. |
1494 * <p> |
1493 * <p> |
1495 * If the logger is currently enabled for the CONFIG message |
1494 * If the logger is currently enabled for the CONFIG message |
1496 * level then the given message is forwarded to all the |
1495 * level then the given message is forwarded to all the |
1497 * registered output Handler objects. |
1496 * registered output Handler objects. |
1498 * <p> |
1497 * |
1499 * @param msg The string message (or a key in the message catalog) |
1498 * @param msg The string message (or a key in the message catalog) |
1500 */ |
1499 */ |
1501 public void config(String msg) { |
1500 public void config(String msg) { |
1502 log(Level.CONFIG, msg); |
1501 log(Level.CONFIG, msg); |
1503 } |
1502 } |
1506 * Log a FINE message. |
1505 * Log a FINE message. |
1507 * <p> |
1506 * <p> |
1508 * If the logger is currently enabled for the FINE message |
1507 * If the logger is currently enabled for the FINE message |
1509 * level then the given message is forwarded to all the |
1508 * level then the given message is forwarded to all the |
1510 * registered output Handler objects. |
1509 * registered output Handler objects. |
1511 * <p> |
1510 * |
1512 * @param msg The string message (or a key in the message catalog) |
1511 * @param msg The string message (or a key in the message catalog) |
1513 */ |
1512 */ |
1514 public void fine(String msg) { |
1513 public void fine(String msg) { |
1515 log(Level.FINE, msg); |
1514 log(Level.FINE, msg); |
1516 } |
1515 } |
1519 * Log a FINER message. |
1518 * Log a FINER message. |
1520 * <p> |
1519 * <p> |
1521 * If the logger is currently enabled for the FINER message |
1520 * If the logger is currently enabled for the FINER message |
1522 * level then the given message is forwarded to all the |
1521 * level then the given message is forwarded to all the |
1523 * registered output Handler objects. |
1522 * registered output Handler objects. |
1524 * <p> |
1523 * |
1525 * @param msg The string message (or a key in the message catalog) |
1524 * @param msg The string message (or a key in the message catalog) |
1526 */ |
1525 */ |
1527 public void finer(String msg) { |
1526 public void finer(String msg) { |
1528 log(Level.FINER, msg); |
1527 log(Level.FINER, msg); |
1529 } |
1528 } |
1532 * Log a FINEST message. |
1531 * Log a FINEST message. |
1533 * <p> |
1532 * <p> |
1534 * If the logger is currently enabled for the FINEST message |
1533 * If the logger is currently enabled for the FINEST message |
1535 * level then the given message is forwarded to all the |
1534 * level then the given message is forwarded to all the |
1536 * registered output Handler objects. |
1535 * registered output Handler objects. |
1537 * <p> |
1536 * |
1538 * @param msg The string message (or a key in the message catalog) |
1537 * @param msg The string message (or a key in the message catalog) |
1539 */ |
1538 */ |
1540 public void finest(String msg) { |
1539 public void finest(String msg) { |
1541 log(Level.FINEST, msg); |
1540 log(Level.FINEST, msg); |
1542 } |
1541 } |
1552 * <p> |
1551 * <p> |
1553 * If the logger is currently enabled for the SEVERE message |
1552 * If the logger is currently enabled for the SEVERE message |
1554 * level then the message is constructed by invoking the provided |
1553 * level then the message is constructed by invoking the provided |
1555 * supplier function and forwarded to all the registered output |
1554 * supplier function and forwarded to all the registered output |
1556 * Handler objects. |
1555 * Handler objects. |
1557 * <p> |
1556 * |
1558 * @param msgSupplier A function, which when called, produces the |
1557 * @param msgSupplier A function, which when called, produces the |
1559 * desired log message |
1558 * desired log message |
1560 * @since 1.8 |
1559 * @since 1.8 |
1561 */ |
1560 */ |
1562 public void severe(Supplier<String> msgSupplier) { |
1561 public void severe(Supplier<String> msgSupplier) { |
1569 * <p> |
1568 * <p> |
1570 * If the logger is currently enabled for the WARNING message |
1569 * If the logger is currently enabled for the WARNING message |
1571 * level then the message is constructed by invoking the provided |
1570 * level then the message is constructed by invoking the provided |
1572 * supplier function and forwarded to all the registered output |
1571 * supplier function and forwarded to all the registered output |
1573 * Handler objects. |
1572 * Handler objects. |
1574 * <p> |
1573 * |
1575 * @param msgSupplier A function, which when called, produces the |
1574 * @param msgSupplier A function, which when called, produces the |
1576 * desired log message |
1575 * desired log message |
1577 * @since 1.8 |
1576 * @since 1.8 |
1578 */ |
1577 */ |
1579 public void warning(Supplier<String> msgSupplier) { |
1578 public void warning(Supplier<String> msgSupplier) { |
1586 * <p> |
1585 * <p> |
1587 * If the logger is currently enabled for the INFO message |
1586 * If the logger is currently enabled for the INFO message |
1588 * level then the message is constructed by invoking the provided |
1587 * level then the message is constructed by invoking the provided |
1589 * supplier function and forwarded to all the registered output |
1588 * supplier function and forwarded to all the registered output |
1590 * Handler objects. |
1589 * Handler objects. |
1591 * <p> |
1590 * |
1592 * @param msgSupplier A function, which when called, produces the |
1591 * @param msgSupplier A function, which when called, produces the |
1593 * desired log message |
1592 * desired log message |
1594 * @since 1.8 |
1593 * @since 1.8 |
1595 */ |
1594 */ |
1596 public void info(Supplier<String> msgSupplier) { |
1595 public void info(Supplier<String> msgSupplier) { |
1603 * <p> |
1602 * <p> |
1604 * If the logger is currently enabled for the CONFIG message |
1603 * If the logger is currently enabled for the CONFIG message |
1605 * level then the message is constructed by invoking the provided |
1604 * level then the message is constructed by invoking the provided |
1606 * supplier function and forwarded to all the registered output |
1605 * supplier function and forwarded to all the registered output |
1607 * Handler objects. |
1606 * Handler objects. |
1608 * <p> |
1607 * |
1609 * @param msgSupplier A function, which when called, produces the |
1608 * @param msgSupplier A function, which when called, produces the |
1610 * desired log message |
1609 * desired log message |
1611 * @since 1.8 |
1610 * @since 1.8 |
1612 */ |
1611 */ |
1613 public void config(Supplier<String> msgSupplier) { |
1612 public void config(Supplier<String> msgSupplier) { |
1620 * <p> |
1619 * <p> |
1621 * If the logger is currently enabled for the FINE message |
1620 * If the logger is currently enabled for the FINE message |
1622 * level then the message is constructed by invoking the provided |
1621 * level then the message is constructed by invoking the provided |
1623 * supplier function and forwarded to all the registered output |
1622 * supplier function and forwarded to all the registered output |
1624 * Handler objects. |
1623 * Handler objects. |
1625 * <p> |
1624 * |
1626 * @param msgSupplier A function, which when called, produces the |
1625 * @param msgSupplier A function, which when called, produces the |
1627 * desired log message |
1626 * desired log message |
1628 * @since 1.8 |
1627 * @since 1.8 |
1629 */ |
1628 */ |
1630 public void fine(Supplier<String> msgSupplier) { |
1629 public void fine(Supplier<String> msgSupplier) { |
1637 * <p> |
1636 * <p> |
1638 * If the logger is currently enabled for the FINER message |
1637 * If the logger is currently enabled for the FINER message |
1639 * level then the message is constructed by invoking the provided |
1638 * level then the message is constructed by invoking the provided |
1640 * supplier function and forwarded to all the registered output |
1639 * supplier function and forwarded to all the registered output |
1641 * Handler objects. |
1640 * Handler objects. |
1642 * <p> |
1641 * |
1643 * @param msgSupplier A function, which when called, produces the |
1642 * @param msgSupplier A function, which when called, produces the |
1644 * desired log message |
1643 * desired log message |
1645 * @since 1.8 |
1644 * @since 1.8 |
1646 */ |
1645 */ |
1647 public void finer(Supplier<String> msgSupplier) { |
1646 public void finer(Supplier<String> msgSupplier) { |
1654 * <p> |
1653 * <p> |
1655 * If the logger is currently enabled for the FINEST message |
1654 * If the logger is currently enabled for the FINEST message |
1656 * level then the message is constructed by invoking the provided |
1655 * level then the message is constructed by invoking the provided |
1657 * supplier function and forwarded to all the registered output |
1656 * supplier function and forwarded to all the registered output |
1658 * Handler objects. |
1657 * Handler objects. |
1659 * <p> |
1658 * |
1660 * @param msgSupplier A function, which when called, produces the |
1659 * @param msgSupplier A function, which when called, produces the |
1661 * desired log message |
1660 * desired log message |
1662 * @since 1.8 |
1661 * @since 1.8 |
1663 */ |
1662 */ |
1664 public void finest(Supplier<String> msgSupplier) { |
1663 public void finest(Supplier<String> msgSupplier) { |
1767 handlers.remove(handler); |
1766 handlers.remove(handler); |
1768 } |
1767 } |
1769 |
1768 |
1770 /** |
1769 /** |
1771 * Get the Handlers associated with this logger. |
1770 * Get the Handlers associated with this logger. |
1772 * <p> |
1771 * |
1773 * @return an array of all registered Handlers |
1772 * @return an array of all registered Handlers |
1774 */ |
1773 */ |
1775 public Handler[] getHandlers() { |
1774 public Handler[] getHandlers() { |
1776 return accessCheckedHandlers(); |
1775 return accessCheckedHandlers(); |
1777 } |
1776 } |
2013 /** |
2012 /** |
2014 * Set the parent for this Logger. This method is used by |
2013 * Set the parent for this Logger. This method is used by |
2015 * the LogManager to update a Logger when the namespace changes. |
2014 * the LogManager to update a Logger when the namespace changes. |
2016 * <p> |
2015 * <p> |
2017 * It should not be called from application code. |
2016 * It should not be called from application code. |
2018 * <p> |
2017 * |
2019 * @param parent the new parent logger |
2018 * @param parent the new parent logger |
2020 * @throws SecurityException if a security manager exists and if |
2019 * @throws SecurityException if a security manager exists and if |
2021 * the caller does not have LoggingPermission("control"). |
2020 * the caller does not have LoggingPermission("control"). |
2022 */ |
2021 */ |
2023 public void setParent(Logger parent) { |
2022 public void setParent(Logger parent) { |