Created
February 29, 2016 03:15
-
-
Save JunNakamura/414e1b18f35bc459c800 to your computer and use it in GitHub Desktop.
javaでメソッド毎のロギング ref: http://qiita.com/n_slender/items/2f0c8b1d0226734d664c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Around("execution(public * hoge.*.*(..))") | |
| public Object logging(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { | |
| String method = proceedingJoinPoint.getSignature().toShortString(); | |
| try { | |
| logger.info("START {}", method); | |
| return proceedingJoinPoint.proceed(); | |
| } catch (Throwable t) { | |
| logger.warn("{} failed.", method); | |
| throw t; | |
| } finally { | |
| stopWatch.stop(); | |
| logger.info("END {}", method); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Loggable | |
| public int doSomething(int a) { | |
| ... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment