Skip to content
Related Articles

Related Articles

LogRecord getResourceBundleName() method in Java with Examples

View Discussion
Improve Article
Save Article
  • Last Updated : 23 Oct, 2019
View Discussion
Improve Article
Save Article

The getResourceBundleName() method of java.lang.reflect.LogRecord is used to get the localization resource bundle name.

Syntax:

public String getResourceBundleName()

Parameters: This method accepts nothing.

Return: This method returns the localization resource bundle name.

Below programs illustrate getResourceBundleName() method:
Program 1:




// Java program to illustrate
// getResourceBundleName() method
  
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.ResourceBundle;
  
public class GFG {
  
    public static void main(String[] args)
    {
  
        // Create LogRecord object
        LogRecord logRecord = new LogRecord(
            Level.parse("800"),
            "Hi Logger");
        logRecord.setResourceBundleName(
            "GFG Bundle");
  
        // get ResourceBundle Name
        String resourceBundleName
            = logRecord.getResourceBundleName();
  
        // print the ResourceBundle name
        System.out.println(
            "Resource Bundle = "
            + resourceBundleName);
    }
}

Output:

Resource Bundle = GFG Bundle

Program 2:




// Java program to illustrate
// getResourceBundleName() method
  
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.ResourceBundle;
  
public class GFG {
  
    public static void main(String[] args)
    {
  
        // Create LogRecord object
        LogRecord logRecord = new LogRecord(
            Level.parse("600"),
            "GFG Logger");
        logRecord.setResourceBundleName(
            "LOGGER Bundle");
  
        // get ResourceBundle Name
        String resourceBundleName
            = logRecord.getResourceBundleName();
  
        // print the ResourceBundle name
        System.out.println(
            "Resource Bundle = "
            + resourceBundleName);
    }
}

Output:

Resource Bundle = LOGGER Bundle

References: https://docs.oracle.com/javase/10/docs/api/java/util/logging/LogRecord.html#getResourceBundleName()


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!