[java] SLF4J에서 로깅 메시지에 예외 트레이스의 시작 위치를 포함하는 방법은 무엇인가요?

예를 들어, 다음과 같이 로그 메시지에 예외 트레이스의 시작 위치를 포함하려면:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ExampleClass {
    private static final Logger logger = LoggerFactory.getLogger(ExampleClass.class);

    public void exampleMethod() {
        try {
            // 예외가 발생할 수 있는 코드
        } catch (Exception e) {
            logger.error("예외 발생: {}", e.getMessage(), e);
        }
    }
}

이를 통해 로그 출력에서는 예외 트레이스의 시작 위치가 포함된 메시지를 확인할 수 있습니다. 예를 들어:

예외 발생: 예외 메시지
java.lang.Exception: 예외 발생 위치...
    at com.example.ExampleClass.exampleMethod(ExampleClass.java:10)
    ...