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 736B

1234567891011121314151617181920212223242526
  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 mvcgrafik.logger;
  7. import java.util.Date;
  8. import java.util.logging.Formatter;
  9. import java.util.logging.LogRecord;
  10. /**
  11. *
  12. * @author chris
  13. */
  14. public class MyFormatter extends Formatter {
  15. @Override
  16. public String format(LogRecord lr) {
  17. String date = String.format("%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp", new Date(lr.getMillis()));
  18. String s = ("| ")+lr.getMillis()+(" | ")+date+(" | ")+lr.getLevel().toString()+(" | ")+lr.getSourceClassName()+(" | ")+lr.getMessage()+(" | ")+"\n";
  19. return s;
  20. }
  21. }