Create Logger From Properties Text File

Load a Logger object with properties from a Text File using LogManager.

Javadoc available at https://www.javatapas.com/docs/javatapas/util/CreateLoggerFromPropertiesFile.html


public Logger createLoggerFromPropertiesFile (String logConfigFileName) throws IOException {

	File logConfigFile = new File(logConfigFileName);

	Logger logger = Logger.getLogger(logConfigFile.getName());

	InputStream logConfigInputStream = new FileInputStream(logConfigFile);

	LogManager logManager = LogManager.getLogManager();

	logManager.addLogger(logger);

	logManager.readConfiguration(logConfigInputStream);

	return logger;

}