'JAVA'에 해당되는 글 22건

  1. 2013.06.04 로그 성능 관련 isDebugEnabled
  2. 2013.05.21 자바 formatter
JAVA2013. 6. 4. 10:24

Log4J 에서 isDebugEnabled()로 체크해줘야 하는 이유

  - 자바에서는 String이 immutable 이므로 + 연산이 일어날때 마다 새로운 String 객체가 생성되는 오버헤드가 발생되게 된다.

Posted by 선한열심
JAVA2013. 5. 21. 17:54

  Formatter formatter = new Formatter();
  
  formatter.format("%tY-%<tm-%<td %<tp %<tH:%<tI:%<tM \n", new Date());
  formatter.format("%tB %<tb %<tA %<ta \n", new Date());
  
  formatter.format(Locale.US, "%tY-%<tm-%<td %<tp %<tH:%<tI:%<tM \n", new Date());
  formatter.format(Locale.US, "%tB %<tb %<tA %<ta \n", new Date());
  
  formatter.format("%tF %<tT \n", new Date());
  System.out.println(formatter.toString());

 

2013-05-21 오후 17:05:52
5월 5월 화요일 화
2013-05-21 pm 17:05:52
May May Tuesday Tue
2013-05-21 17:52:32

Posted by 선한열심