LogRecord setParameters() method in Java with Examples Last Updated : 18 Oct, 2019 Comments Improve Suggest changes Like Article Like Report The setParameters() method of java.util.logging.LogRecord is used to set the parameters to the log message.These parameters are the parameters to be inserted into the message of this LogRecord. Syntax: public void setParameters(Object[] parameters) Parameters: This method accepts parameters as parameter which are the log message parameters in the form of Object[]. Return: This method returns nothing. Below programs illustrate setParameters() method: Program 1: Java // Java program to illustrate setParameters() method import java.util.logging.Level; import java.util.logging.LogRecord; public class GFG { public static void main(String[] args) { // Create LogRecord object LogRecord logRecord = new LogRecord( Level.parse("800"), "Hi Logger"); // set empty object array logRecord.setParameters(new Object[] {}); System.out.println( "Object Array length: " + logRecord.getParameters().length); } } Output: Object Array length: 0 Program 2: Java // Java program to illustrate setParameters() method import java.lang.reflect.Method; import java.util.logging.Level; import java.util.logging.LogRecord; public class GFG { public static void main(String[] args) { // Create LogRecord object LogRecord logRecord = new LogRecord( Level.parse("800"), "Hi Logger"); // get parameter object array // from string class method Method method = String.class.getDeclaredMethods()[4]; System.out.println("Method : " + method.getName()); Object[] objArr = method.getParameters(); // set empty object array logRecord.setParameters(objArr); // get array Object[] array = logRecord.getParameters(); for (int i = 0; i < array.length; i++) { System.out.println(array[i]); } } } Output: Method : compareTo java.lang.Object arg0 References: https://docs.oracle.com/javase/8/docs/api/java/util/logging/LogRecord.html#setParameters-java.lang.Object:A- Comment More infoAdvertise with us Next Article LogRecord setParameters() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Java-LogRecord java.util.logging package Practice Tags : Java Similar Reads LogRecord setMessage() method in Java with Examples The setMessage() method of java.util.logging.LogRecord is used to set the "raw" log message, before localization or formatting for this LogRecord object.we can also set null as raw message. Syntax: public void setMessage(String message) Parameters: This method accepts message which is the raw messag 1 min read LogRecord setLevel() method in Java with Examples The setLevel() method of java.util.logging.LogRecord is used to set the level of logging message, for example Level.INFO for this LogRecord Object. Syntax: public void setLevel(Level level) Parameters: This method accepts level which is the logging message level. Return: This method returns nothing. 1 min read Logger setParent() method in Java with Examples setParent() method of a Logger class used to set the parent Logger of this current Logger.The parent Logger we want to set is passed as a parameter. LogManager use this method to update a Logger when the namespace changes. Syntax: public void setParent(Logger parent) Parameters: This method accepts 2 min read LogRecord setThrown() method in Java with Examples The setThrown() method of java.util.logging.LogRecord is used to a throwable associated with the log event.This is used to log Exceptions in the logRecord that can be used for logging messages. Syntax: public void setThrown(Throwable thrown) Parameters: This method accepts thrown as a parameter whic 2 min read LogRecord setLoggerName() method in Java with Examples The setLoggerName() method of java.util.logging.LogRecord is used to set the logger name of source.This method returns source logger name if present else returns null. Syntax: public void setLoggerName(String name) Parameters: This method accepts the Source Logger name as a string which can be null 1 min read Like