You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MyFormatter.java 756B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package logger.MyFormatter;
  7. import java.util.Date;
  8. import java.util.logging.LogRecord;
  9. import java.util.logging.SimpleFormatter;
  10. /**
  11. *
  12. * @author nobody
  13. */
  14. public class MyFormatter extends SimpleFormatter
  15. {
  16. private String message;
  17. private final Date dat = new Date();
  18. @Override
  19. public String format(LogRecord record)
  20. {
  21. dat.setTime(record.getMillis());
  22. message = "| " + dat + " | " + record.getLevel() + " | "
  23. + record.getSourceClassName() + " | " + record.getMessage() + " |\n";
  24. return message;
  25. }
  26. public MyFormatter()
  27. {
  28. }
  29. }