Level getLocalizedName() method in Java with Examples
Last Updated :
14 Mar, 2022
The getLocalizedName() method of java.util.logging.Level is used to get the localized string name of the Level.This method returns localized name, for the current default locale. If no localization information is available, the non-localized name is returned.
Syntax:
public String getLocalizedName()
Parameters: This method accepts nothing.
Return: This method returns localized name of this Level.
Below programs illustrate getLocalizedName() method:
Program 1:
import java.util.logging.Level;
import java.util.logging.Logger;
public class GFG {
public static void main(String[] args)
{
Logger logger
= Logger.getLogger(
Object. class .getName())
.getParent();
Level level
= logger.getLevel();
String name = level.getLocalizedName();
System.out.println( "Localized Name = "
+ name);
}
}
|
Output:
Localized Name = INFO
Program 2:
import java.util.logging.Level;
public class GFG {
public static void main(String[] args)
{
Level level
= Level.parse( "SEVERE" );
String name = level.getLocalizedName();
System.out.println( "Localized Name = "
+ name);
}
}
|
Output:
Localized Name = SEVERE
References: https://docs.oracle.com/javase/10/docs/api/java/util/logging/Level.html#getLocalizedName()
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...