Open In App

LogManager getProperty() method in Java with Examples

Improve
Improve
Like Article
Like
Save
Share
Report

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:

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-


Last Updated : 29 Oct, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads