Created
June 23, 2017 00:07
-
-
Save javajosh/05065301436bc764b3253186833f9ea1 to your computer and use it in GitHub Desktop.
java.util.logger simple example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final static Logger LOGGER = Logger.getLogger(Main.class.getName()); | |
private static void setupLogger(){ | |
FileHandler fileTxt = null; | |
try { | |
fileTxt = new FileHandler("runtime.log"); | |
} catch (IOException ignored) {} | |
SimpleFormatter formatterTxt = new SimpleFormatter(); | |
fileTxt.setFormatter(formatterTxt); | |
LOGGER.severe("Severe Log"); | |
LOGGER.addHandler(fileTxt); | |
LOGGER.warning("Warning Log"); | |
LOGGER.info("Info Log"); | |
LOGGER.finest("Finest"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment