I currently have this code in my main().
Logger logger = Logger.getLogger("My Log");
FileHandler fh;
logger.addHandler(fh);
SimpleFormatter formatter = new SimpleFormatter();
fh.setFormatter(formatter);
logger.info("Test");
This outputs 2 lines. One with datetime, and the other is test. I read many other questions on this site, but i do not get how to implement it to my current code.
UPDATE: I have created a new file called logging.properties and updated Logger logger = Logger.getLogger("logging.properties");
Inside the file i inputted these values
handlers= java.util.logging.ConsoleHandler
.level= INFO
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
javax.jms.connection.level = INFO
java.util.logging.SimpleFormatter.format=[%1$tF %1$tr] %3$s %4$s: %5$s %n
But when i run i still see the date line. What am i missing?