Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- LOGGING UTILITY CLASS --
- package com.simone.test1.Log;
- import java.io.InputStream;
- import java.util.logging.Logger;
- import java.util.logging.LogManager;
- public class LogUtils
- {
- @SuppressWarnings("rawtypes")
- static public Logger GetLogObject(Class InputClass)
- {
- Logger ReturningLogObject = null;
- InputStream stream = InputClass.getClassLoader().getResourceAsStream("logging.properties");
- try
- {
- LogManager.getLogManager().readConfiguration(stream);
- ReturningLogObject = Logger.getLogger(InputClass.getSimpleName());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return ReturningLogObject;
- }
- }
- == LOGGING.PROPERTIES (GOES IN RESOURCES) ==
- handlers= java.util.logging.ConsoleHandler
- .level= INFO
- java.util.logging.ConsoleHandler.level = INFO
- java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
- java.util.logging.SimpleFormatter.format=[%1$tb %1$td %1$tY %1$tl:%1$tM:%1$tS] [%3$s] [%4$s]: %5$s%n
Add Comment
Please, Sign In to add comment