Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

LogManager getProperty() method in Java with Examples

  • Last Updated : 29 Oct, 2019

The getProperty() method of java.util.logging.LogManager is used to get the value of the specified propertyName in this LogManager instance. This method will get this property in this LogManager if it exists. If it does not exists, then this method returns null.

Syntax:

Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

public String getProperty(String propertyName)

Parameters: This method accepts a parameter propertyName which is the name of the property to be get in this LogManager instance.

Return Value: This method returns the name of this property in this LogManager if it exists. If it does not exists, then this method returns null.



Below programs illustrate getProperty() method:




// Java program to illustrate
// LogManager getProperty() method
  
import java.util.logging.*;
import java.util.*;
  
public class GFG {
  
    public static void main(String[] args)
    {
  
        // Create LogManager object
        LogManager logManager
            = LogManager.getLogManager();
  
        String propertyName = "GFG";
        System.out.println(
            "\nGet Property value of "
            + propertyName + ": "
            + logManager.getProperty(propertyName));
  
        propertyName = "Global";
        System.out.println(
            "\nGet Property value of "
            + propertyName + ": "
            + logManager.getProperty(propertyName));
    }
}
Output:
Get Property value of GFG: null

Get Property value of Global: null

Reference: https://docs.oracle.com/javase/9/docs/api/java/util/logging/LogManager.html#getProperty-java.lang.String-

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!