-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38c22a0
commit ba75301
Showing
3 changed files
with
31 additions
and
7 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/main/kotlin/kr/galaxyhub/sc/crawler/application/CrawlerLogAop.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package kr.galaxyhub.sc.crawler.application | ||
|
||
import io.github.oshai.kotlinlogging.KotlinLogging | ||
import org.aspectj.lang.JoinPoint | ||
import org.aspectj.lang.annotation.AfterThrowing | ||
import org.aspectj.lang.annotation.Aspect | ||
import org.springframework.stereotype.Component | ||
|
||
private val log = KotlinLogging.logger {} | ||
|
||
@Component | ||
@Aspect | ||
class CrawlerLogAop { | ||
|
||
@AfterThrowing(pointcut = "this(Crawler) && execution(* crawling(String))", throwing = "ex") | ||
fun loggingException(joinPoint: JoinPoint, ex: Exception) { | ||
log.warn { "크롤링 중 예외가 발생했습니다. message: ${ex.message} class: ${joinPoint.target}, url: ${joinPoint.args[0]}" } | ||
} | ||
} |
This file contains 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
This file contains 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