java.util.logging.Logger.setResourceBundle()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(232)

本文整理了Java中java.util.logging.Logger.setResourceBundle()方法的一些代码示例,展示了Logger.setResourceBundle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.setResourceBundle()方法的具体详情如下:
包路径:java.util.logging.Logger
类名称:Logger
方法名:setResourceBundle

Logger.setResourceBundle介绍

[英]Sets the resource bundle and its name for a supplied LogRecord object. This method first tries to use this logger's resource bundle if any, otherwise try to inherit from this logger's parent, recursively up the namespace.
[中]为提供的LogRecord对象设置资源束及其名称。此方法首先尝试使用此记录器的资源包(如果有),否则尝试从该记录器的父级继承,递归地向上扩展命名空间。

代码示例

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logs a message indicating that a method has been entered. A log record
  3. * with log level {@code Level.FINER}, log message "ENTRY", the specified
  4. * source class name and source method name is submitted for logging.
  5. *
  6. * @param sourceClass
  7. * the calling class name.
  8. * @param sourceMethod
  9. * the method name.
  10. */
  11. public void entering(String sourceClass, String sourceMethod) {
  12. if (!internalIsLoggable(Level.FINER)) {
  13. return;
  14. }
  15. LogRecord record = new LogRecord(Level.FINER, "ENTRY");
  16. record.setLoggerName(this.name);
  17. record.setSourceClassName(sourceClass);
  18. record.setSourceMethodName(sourceMethod);
  19. setResourceBundle(record);
  20. log(record);
  21. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logs a message indicating that a method is exited. A log record with log
  3. * level {@code Level.FINER}, log message "RETURN", the specified source
  4. * class name and source method name is submitted for logging.
  5. *
  6. * @param sourceClass
  7. * the calling class name.
  8. * @param sourceMethod
  9. * the method name.
  10. */
  11. public void exiting(String sourceClass, String sourceMethod) {
  12. if (!internalIsLoggable(Level.FINER)) {
  13. return;
  14. }
  15. LogRecord record = new LogRecord(Level.FINER, "RETURN");
  16. record.setLoggerName(this.name);
  17. record.setSourceClassName(sourceClass);
  18. record.setSourceMethodName(sourceMethod);
  19. setResourceBundle(record);
  20. log(record);
  21. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logs a message of the specified level with the supplied {@code Throwable}
  3. * object. The message is then transmitted to all subscribed handlers.
  4. *
  5. * @param logLevel
  6. * the level of the given message.
  7. * @param msg
  8. * the message to log.
  9. * @param thrown
  10. * the {@code Throwable} object associated with the event that is
  11. * logged.
  12. */
  13. public void log(Level logLevel, String msg, Throwable thrown) {
  14. if (!internalIsLoggable(logLevel)) {
  15. return;
  16. }
  17. LogRecord record = new LogRecord(logLevel, msg);
  18. record.setLoggerName(this.name);
  19. record.setThrown(thrown);
  20. setResourceBundle(record);
  21. log(record);
  22. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logs a message of the given level with the specified source class name
  3. * and source method name.
  4. *
  5. * @param logLevel
  6. * the level of the given message.
  7. * @param sourceClass
  8. * the source class name.
  9. * @param sourceMethod
  10. * the source method name.
  11. * @param msg
  12. * the message to be logged.
  13. */
  14. public void logp(Level logLevel, String sourceClass, String sourceMethod,
  15. String msg) {
  16. if (!internalIsLoggable(logLevel)) {
  17. return;
  18. }
  19. LogRecord record = new LogRecord(logLevel, msg);
  20. record.setLoggerName(this.name);
  21. record.setSourceClassName(sourceClass);
  22. record.setSourceMethodName(sourceMethod);
  23. setResourceBundle(record);
  24. log(record);
  25. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logs a message indicating that an exception is thrown. A log record with
  3. * log level {@code Level.FINER}, log message "THROW", the specified source
  4. * class name, source method name and the {@code Throwable} object is
  5. * submitted for logging.
  6. *
  7. * @param sourceClass
  8. * the source class name.
  9. * @param sourceMethod
  10. * the source method name.
  11. * @param thrown
  12. * the {@code Throwable} object.
  13. */
  14. public void throwing(String sourceClass, String sourceMethod,
  15. Throwable thrown) {
  16. if (!internalIsLoggable(Level.FINER)) {
  17. return;
  18. }
  19. LogRecord record = new LogRecord(Level.FINER, "THROW");
  20. record.setLoggerName(this.name);
  21. record.setSourceClassName(sourceClass);
  22. record.setSourceMethodName(sourceMethod);
  23. record.setThrown(thrown);
  24. setResourceBundle(record);
  25. log(record);
  26. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logs a message of the given level with the specified source class name,
  3. * source method name and {@code Throwable} object.
  4. *
  5. * @param logLevel
  6. * the level of the given message.
  7. * @param sourceClass
  8. * the source class name.
  9. * @param sourceMethod
  10. * the source method name.
  11. * @param msg
  12. * the message to be logged.
  13. * @param thrown
  14. * the {@code Throwable} object.
  15. */
  16. public void logp(Level logLevel, String sourceClass, String sourceMethod,
  17. String msg, Throwable thrown) {
  18. if (!internalIsLoggable(logLevel)) {
  19. return;
  20. }
  21. LogRecord record = new LogRecord(logLevel, msg);
  22. record.setLoggerName(this.name);
  23. record.setSourceClassName(sourceClass);
  24. record.setSourceMethodName(sourceMethod);
  25. record.setThrown(thrown);
  26. setResourceBundle(record);
  27. log(record);
  28. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logs a message indicating that a method is exited. A log record with log
  3. * level {@code Level.FINER}, log message "RETURN", the specified source
  4. * class name, source method name and return value is submitted for logging.
  5. *
  6. * @param sourceClass
  7. * the source class name.
  8. * @param sourceMethod
  9. * the source method name.
  10. * @param result
  11. * the return value of the method call.
  12. */
  13. public void exiting(String sourceClass, String sourceMethod, Object result) {
  14. if (!internalIsLoggable(Level.FINER)) {
  15. return;
  16. }
  17. LogRecord record = new LogRecord(Level.FINER, "RETURN" + " {0}");
  18. record.setLoggerName(this.name);
  19. record.setSourceClassName(sourceClass);
  20. record.setSourceMethodName(sourceMethod);
  21. record.setParameters(new Object[] { result });
  22. setResourceBundle(record);
  23. log(record);
  24. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logs a message of the specified level with the supplied parameter array.
  3. * The message is then transmitted to all subscribed handlers.
  4. *
  5. * @param logLevel
  6. * the level of the given message
  7. * @param msg
  8. * the message to log.
  9. * @param params
  10. * the parameter array associated with the event that is logged.
  11. */
  12. public void log(Level logLevel, String msg, Object[] params) {
  13. if (!internalIsLoggable(logLevel)) {
  14. return;
  15. }
  16. LogRecord record = new LogRecord(logLevel, msg);
  17. record.setLoggerName(this.name);
  18. record.setParameters(params);
  19. setResourceBundle(record);
  20. log(record);
  21. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logs a message of the specified level with the supplied parameter. The
  3. * message is then transmitted to all subscribed handlers.
  4. *
  5. * @param logLevel
  6. * the level of the given message.
  7. * @param msg
  8. * the message to log.
  9. * @param param
  10. * the parameter associated with the event that is logged.
  11. */
  12. public void log(Level logLevel, String msg, Object param) {
  13. if (!internalIsLoggable(logLevel)) {
  14. return;
  15. }
  16. LogRecord record = new LogRecord(logLevel, msg);
  17. record.setLoggerName(this.name);
  18. record.setParameters(new Object[] { param });
  19. setResourceBundle(record);
  20. log(record);
  21. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logs a message indicating that a method has been entered. A log record
  3. * with log level {@code Level.FINER}, log message "ENTRY", the specified
  4. * source class name, source method name and one parameter is submitted for
  5. * logging.
  6. *
  7. * @param sourceClass
  8. * the source class name.
  9. * @param sourceMethod
  10. * the source method name.
  11. * @param param
  12. * the parameter for the method call.
  13. */
  14. public void entering(String sourceClass, String sourceMethod, Object param) {
  15. if (!internalIsLoggable(Level.FINER)) {
  16. return;
  17. }
  18. LogRecord record = new LogRecord(Level.FINER, "ENTRY" + " {0}");
  19. record.setLoggerName(this.name);
  20. record.setSourceClassName(sourceClass);
  21. record.setSourceMethodName(sourceMethod);
  22. record.setParameters(new Object[] { param });
  23. setResourceBundle(record);
  24. log(record);
  25. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logs a message of the given level with the specified source class name,
  3. * source method name and parameter array.
  4. *
  5. * @param logLevel
  6. * the level of the given message.
  7. * @param sourceClass
  8. * the source class name.
  9. * @param sourceMethod
  10. * the source method name.
  11. * @param msg
  12. * the message to be logged.
  13. * @param params
  14. * the parameter array associated with the event that is logged.
  15. */
  16. public void logp(Level logLevel, String sourceClass, String sourceMethod,
  17. String msg, Object[] params) {
  18. if (!internalIsLoggable(logLevel)) {
  19. return;
  20. }
  21. LogRecord record = new LogRecord(logLevel, msg);
  22. record.setLoggerName(this.name);
  23. record.setSourceClassName(sourceClass);
  24. record.setSourceMethodName(sourceMethod);
  25. record.setParameters(params);
  26. setResourceBundle(record);
  27. log(record);
  28. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logs a message of the given level with the specified source class name,
  3. * source method name and parameter.
  4. *
  5. * @param logLevel
  6. * the level of the given message
  7. * @param sourceClass
  8. * the source class name
  9. * @param sourceMethod
  10. * the source method name
  11. * @param msg
  12. * the message to be logged
  13. * @param param
  14. * the parameter associated with the event that is logged.
  15. */
  16. public void logp(Level logLevel, String sourceClass, String sourceMethod,
  17. String msg, Object param) {
  18. if (!internalIsLoggable(logLevel)) {
  19. return;
  20. }
  21. LogRecord record = new LogRecord(logLevel, msg);
  22. record.setLoggerName(this.name);
  23. record.setSourceClassName(sourceClass);
  24. record.setSourceMethodName(sourceMethod);
  25. record.setParameters(new Object[] { param });
  26. setResourceBundle(record);
  27. log(record);
  28. }

代码示例来源:origin: robovm/robovm

  1. record.setSourceMethodName(sourceMethod);
  2. record.setParameters(params);
  3. setResourceBundle(record);
  4. log(record);

代码示例来源:origin: com.jtransc/jtransc-rt

  1. public void logp(Level logLevel, String sourceClass, String sourceMethod, String msg) {
  2. if (!internalIsLoggable(logLevel)) return;
  3. LogRecord record = new LogRecord(logLevel, msg);
  4. record.setLoggerName(this.name);
  5. record.setSourceClassName(sourceClass);
  6. record.setSourceMethodName(sourceMethod);
  7. setResourceBundle(record);
  8. log(record);
  9. }

代码示例来源:origin: com.jtransc/jtransc-rt

  1. public void log(Level logLevel, String msg, Throwable thrown) {
  2. if (!internalIsLoggable(logLevel)) return;
  3. LogRecord record = new LogRecord(logLevel, msg);
  4. record.setLoggerName(this.name);
  5. record.setThrown(thrown);
  6. setResourceBundle(record);
  7. log(record);
  8. }

代码示例来源:origin: com.jtransc/jtransc-rt

  1. public void exiting(String sourceClass, String sourceMethod) {
  2. if (!internalIsLoggable(Level.FINER)) return;
  3. LogRecord record = new LogRecord(Level.FINER, "RETURN");
  4. record.setLoggerName(this.name);
  5. record.setSourceClassName(sourceClass);
  6. record.setSourceMethodName(sourceMethod);
  7. setResourceBundle(record);
  8. log(record);
  9. }

代码示例来源:origin: com.jtransc/jtransc-rt

  1. public void logp(Level logLevel, String sourceClass, String sourceMethod, String msg, Throwable thrown) {
  2. if (!internalIsLoggable(logLevel)) return;
  3. LogRecord record = new LogRecord(logLevel, msg);
  4. record.setLoggerName(this.name);
  5. record.setSourceClassName(sourceClass);
  6. record.setSourceMethodName(sourceMethod);
  7. record.setThrown(thrown);
  8. setResourceBundle(record);
  9. log(record);
  10. }

代码示例来源:origin: com.jtransc/jtransc-rt

  1. public void logp(Level logLevel, String sourceClass, String sourceMethod, String msg, Object[] params) {
  2. if (!internalIsLoggable(logLevel)) return;
  3. LogRecord record = new LogRecord(logLevel, msg);
  4. record.setLoggerName(this.name);
  5. record.setSourceClassName(sourceClass);
  6. record.setSourceMethodName(sourceMethod);
  7. record.setParameters(params);
  8. setResourceBundle(record);
  9. log(record);
  10. }

代码示例来源:origin: com.jtransc/jtransc-rt

  1. public void entering(String sourceClass, String sourceMethod, Object param) {
  2. if (!internalIsLoggable(Level.FINER)) return;
  3. LogRecord record = new LogRecord(Level.FINER, "ENTRY" + " {0}");
  4. record.setLoggerName(this.name);
  5. record.setSourceClassName(sourceClass);
  6. record.setSourceMethodName(sourceMethod);
  7. record.setParameters(new Object[] { param });
  8. setResourceBundle(record);
  9. log(record);
  10. }

代码示例来源:origin: com.jtransc/jtransc-rt

  1. public void log(Level logLevel, String msg, Object param) {
  2. if (!internalIsLoggable(logLevel)) return;
  3. LogRecord record = new LogRecord(logLevel, msg);
  4. record.setLoggerName(this.name);
  5. record.setParameters(new Object[] { param });
  6. setResourceBundle(record);
  7. log(record);
  8. }

相关文章