메뉴 건너뛰기

KIM0.COM

JAVA TIPS 로그

2017.02.06 16:33

Martin 조회 수:353

System.out.printf("pgl [%s.%s()Ln%:d-%s]\n",
new Throwable().getStackTrace()[0].getClassName(),
new Throwable().getStackTrace()[0].getMethodName(),
new Throwable().getStackTrace()[0].getLineNumber(),
new java.text.SimpleDateFormat("yyyyMMdd HH:mm:ss").format(new java.util.Date())); // peegol

--- 또는 ---

System.out.println(new java.text.SimpleDateFormat("yyyyMMdd HH:mm:ss").format(new java.util.Date()) + " ["
+ new Throwable().getStackTrace()[0].getClassName() + "." + new Throwable().getStackTrace()[0].getMethodName()
+ "()Ln:" + new Throwable().getStackTrace()[0].getLineNumber() + "] pgl "); // peegol
System.out.println("pgl #> ");
번호 제목 글쓴이 날짜 조회 수
6 java call stack 출력 샘플 (파일, 화면) Martin 2017.03.22 331
5 파일 쓰기 Martin 2017.03.22 351
» 로그 Martin 2017.02.06 353
3 Java MessageBox 출력 Martin 2016.10.24 246
2 접근 제어자 Martin 2016.10.15 61
1 매개 변수 Martin 2016.10.15 102