< prev index next >

jdk/src/java.logging/share/classes/java/util/logging/Logger.java

Print this page




1283         doLog(lr, bundle);
1284     }
1285 
1286     /**
1287      * Log a message, specifying source class, method, and resource bundle,
1288      * with an optional list of message parameters.
1289      * <p>
1290      * If the logger is currently enabled for the given message
1291      * {@code level} then a corresponding {@code LogRecord} is created
1292      * and forwarded to all the registered output {@code Handler} objects.
1293      * <p>
1294      * The {@code msg} string is localized using the given resource bundle.
1295      * If the resource bundle is {@code null}, then the {@code msg} string is not
1296      * localized.
1297      * <p>
1298      * @param   level   One of the message level identifiers, e.g., {@code SEVERE}
1299      * @param   bundle  Resource bundle to localize {@code msg};
1300      *                  can be {@code null}.
1301      * @param   msg     The string message (or a key in the message catalog)
1302      * @param   params  Parameters to the message (optional, may be none).
1303      * @since 1.9
1304      */
1305     public void logrb(Level level, ResourceBundle bundle, String msg, Object... params) {
1306         if (!isLoggable(level)) {
1307             return;
1308         }
1309         LogRecord lr = new LogRecord(level, msg);
1310         if (params != null && params.length != 0) {
1311             lr.setParameters(params);
1312         }
1313         doLog(lr, bundle);
1314     }
1315 
1316     /**
1317      * Log a message, specifying source class, method, and resource bundle name,
1318      * with associated Throwable information.
1319      * <p>
1320      * If the logger is currently enabled for the given message
1321      * level then the given arguments are stored in a LogRecord
1322      * which is forwarded to all registered output handlers.
1323      * <p>


1400      * If the logger is currently enabled for the given message
1401      * {@code level} then the given arguments are stored in a {@code LogRecord}
1402      * which is forwarded to all registered output handlers.
1403      * <p>
1404      * The {@code msg} string is localized using the given resource bundle.
1405      * If the resource bundle is {@code null}, then the {@code msg} string is not
1406      * localized.
1407      * <p>
1408      * Note that the {@code thrown} argument is stored in the {@code LogRecord}
1409      * {@code thrown} property, rather than the {@code LogRecord}
1410      * {@code parameters} property.  Thus it is
1411      * processed specially by output {@code Formatter} objects and is not treated
1412      * as a formatting parameter to the {@code LogRecord} {@code message}
1413      * property.
1414      * <p>
1415      * @param   level   One of the message level identifiers, e.g., {@code SEVERE}
1416      * @param   bundle  Resource bundle to localize {@code msg};
1417      *                  can be {@code null}.
1418      * @param   msg     The string message (or a key in the message catalog)
1419      * @param   thrown  Throwable associated with the log message.
1420      * @since 1.9
1421      */
1422     public void logrb(Level level, ResourceBundle bundle, String msg,
1423             Throwable thrown) {
1424         if (!isLoggable(level)) {
1425             return;
1426         }
1427         LogRecord lr = new LogRecord(level, msg);
1428         lr.setThrown(thrown);
1429         doLog(lr, bundle);
1430     }
1431 
1432     //======================================================================
1433     // Start of convenience methods for logging method entries and returns.
1434     //======================================================================
1435 
1436     /**
1437      * Log a method entry.
1438      * <p>
1439      * This is a convenience method that can be used to log entry
1440      * to a method.  A LogRecord with message "ENTRY", log level




1283         doLog(lr, bundle);
1284     }
1285 
1286     /**
1287      * Log a message, specifying source class, method, and resource bundle,
1288      * with an optional list of message parameters.
1289      * <p>
1290      * If the logger is currently enabled for the given message
1291      * {@code level} then a corresponding {@code LogRecord} is created
1292      * and forwarded to all the registered output {@code Handler} objects.
1293      * <p>
1294      * The {@code msg} string is localized using the given resource bundle.
1295      * If the resource bundle is {@code null}, then the {@code msg} string is not
1296      * localized.
1297      * <p>
1298      * @param   level   One of the message level identifiers, e.g., {@code SEVERE}
1299      * @param   bundle  Resource bundle to localize {@code msg};
1300      *                  can be {@code null}.
1301      * @param   msg     The string message (or a key in the message catalog)
1302      * @param   params  Parameters to the message (optional, may be none).
1303      * @since 9
1304      */
1305     public void logrb(Level level, ResourceBundle bundle, String msg, Object... params) {
1306         if (!isLoggable(level)) {
1307             return;
1308         }
1309         LogRecord lr = new LogRecord(level, msg);
1310         if (params != null && params.length != 0) {
1311             lr.setParameters(params);
1312         }
1313         doLog(lr, bundle);
1314     }
1315 
1316     /**
1317      * Log a message, specifying source class, method, and resource bundle name,
1318      * with associated Throwable information.
1319      * <p>
1320      * If the logger is currently enabled for the given message
1321      * level then the given arguments are stored in a LogRecord
1322      * which is forwarded to all registered output handlers.
1323      * <p>


1400      * If the logger is currently enabled for the given message
1401      * {@code level} then the given arguments are stored in a {@code LogRecord}
1402      * which is forwarded to all registered output handlers.
1403      * <p>
1404      * The {@code msg} string is localized using the given resource bundle.
1405      * If the resource bundle is {@code null}, then the {@code msg} string is not
1406      * localized.
1407      * <p>
1408      * Note that the {@code thrown} argument is stored in the {@code LogRecord}
1409      * {@code thrown} property, rather than the {@code LogRecord}
1410      * {@code parameters} property.  Thus it is
1411      * processed specially by output {@code Formatter} objects and is not treated
1412      * as a formatting parameter to the {@code LogRecord} {@code message}
1413      * property.
1414      * <p>
1415      * @param   level   One of the message level identifiers, e.g., {@code SEVERE}
1416      * @param   bundle  Resource bundle to localize {@code msg};
1417      *                  can be {@code null}.
1418      * @param   msg     The string message (or a key in the message catalog)
1419      * @param   thrown  Throwable associated with the log message.
1420      * @since 9
1421      */
1422     public void logrb(Level level, ResourceBundle bundle, String msg,
1423             Throwable thrown) {
1424         if (!isLoggable(level)) {
1425             return;
1426         }
1427         LogRecord lr = new LogRecord(level, msg);
1428         lr.setThrown(thrown);
1429         doLog(lr, bundle);
1430     }
1431 
1432     //======================================================================
1433     // Start of convenience methods for logging method entries and returns.
1434     //======================================================================
1435 
1436     /**
1437      * Log a method entry.
1438      * <p>
1439      * This is a convenience method that can be used to log entry
1440      * to a method.  A LogRecord with message "ENTRY", log level


< prev index next >