Guest User

Untitled

a guest
Jul 18th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. -- LOGGING UTILITY CLASS --
  2. package com.simone.test1.Log;
  3.  
  4. import java.io.InputStream;
  5. import java.util.logging.Logger;
  6. import java.util.logging.LogManager;
  7.  
  8.  
  9. public class LogUtils
  10. {
  11. @SuppressWarnings("rawtypes")
  12. static public Logger GetLogObject(Class InputClass)
  13. {
  14. Logger ReturningLogObject = null;
  15. InputStream stream = InputClass.getClassLoader().getResourceAsStream("logging.properties");
  16. try
  17. {
  18. LogManager.getLogManager().readConfiguration(stream);
  19. ReturningLogObject = Logger.getLogger(InputClass.getSimpleName());
  20.  
  21. }
  22. catch (Exception e)
  23. {
  24. e.printStackTrace();
  25. }
  26. return ReturningLogObject;
  27. }
  28. }
  29.  
  30. == LOGGING.PROPERTIES (GOES IN RESOURCES) ==
  31. handlers= java.util.logging.ConsoleHandler
  32. .level= INFO
  33. java.util.logging.ConsoleHandler.level = INFO
  34. java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
  35. 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