이벤트 로깅
모니터링 및 진단 기능의 일부로서, WebSphere Application Server Liberty는 Java Platform, Enterprise Edition의 다양한 컴포넌트에서 요청을 추적하기 위한 이벤트를 생성합니다. eventLogging-1.0 기능은 애플리케이션 요청이 실행 중일 때 이러한 이벤트를 로그합니다. 사용자는 이 기능을 사용하여 WebSphere Application Server Liberty에서 실행 중인 요청을 추적할 수 있습니다. 각 요청은 요청 ID라는 고유 상관자 및 사용자가 요청별 데이터를 이해하는 데 도움을 주는 컨텍스트 정보와 연관됩니다.
이벤트 로깅 기능은 서버 구성을 통해 제어됩니다. 이 기능은 server.xml 파일에서 구성됩니다.
[12/15/14 18:24:29:528 IST] 0000002e EventLogging I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | TradeScenarioServlet
[12/15/14 18:24:29:531 IST] 0000002e EventLogging I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | TradeAppServlet
[12/15/14 18:24:29:532 IST] 0000002e EventLogging I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | /quote.jsp
[12/15/14 18:24:29:533 IST] 0000002e EventLogging I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | /displayQuote.jsp
[12/15/14 18:24:29:534 IST] 0000002e EventLogging I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.datasource.psExecuteQuery # contextInfo=jdbc/TradeDataSource | select * from quoteejb q where q.symbol=?
[12/15/14 18:24:29:547 IST] 0000002e EventLogging I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.datasource.psExecuteQuery # contextInfo=jdbc/TradeDataSource | select * from quoteejb q where q.symbol=? # duration=12.537ms
[12/15/14 18:24:29:556 IST] 0000002e EventLogging I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | /displayQuote.jsp # duration=22.171ms
[12/15/14 18:24:29:671 IST] 0000002e EventLogging I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | /displayQuote.jsp
[12/15/14 18:24:29:672 IST] 0000002e EventLogging I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.datasource.psExecuteQuery # contextInfo=jdbc/TradeDataSource | select * from quoteejb q where q.symbol=?
[12/15/14 18:24:29:677 IST] 0000002e EventLogging I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.datasource.psExecuteQuery # contextInfo=jdbc/TradeDataSource | select * from quoteejb q where q.symbol=? # duration=4.968ms
[12/15/14 18:24:29:684 IST] 0000002e EventLogging I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | /displayQuote.jsp # duration=12.569ms
[12/15/14 18:24:29:685 IST] 0000002e EventLogging I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | /quote.jsp # duration=152.752ms
[12/15/14 18:24:29:686 IST] 0000002e EventLogging I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | TradeAppServlet # duration=154.616ms
[12/15/14 18:24:29:687 IST] 0000002e EventLogging I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | TradeScenarioServlet # duration=158.283ms
요청은 BEGIN websphere.servlet.service "contextInfo=TradeWeb | TradeScenarioServlet" 이벤트(샘플 코드의 첫 번째 행 참조)로부터 시작되며 END websphere.servlet.service "contextInfo=TradeWeb | TradeScenarioServlet"(샘플 코드의 마지막 행 참조)에서 종료됩니다. 이 요청에 소요된 총 시간 또한 마지막에 표시됩니다(샘플 코드의 경우 158.283ms).
주 요청의 BEGIN 및 END를 보면 하위 요청을 볼 수 있습니다. 각 하위 요청에 소요된 시간 또한 찾아 볼 수 있습니다.
이벤트 로깅을 사용으로 설정한 경우 최상의 성능을 얻으려면 2진 로깅을 사용하는 것이 좋습니다. 이벤트 로그 항목의 eventType, contextInfo 및 requestID 속성은 로그 레코드 확장자로 저장됩니다. 이러한 로그 레코드 확장자는 binaryLog 명령으로 로그를 필터링하는 데 사용할 수 있습니다.
messages.log 파일의 이벤트 로그 항목 구문 분석
이벤트 로그는 다음 형식으로 이벤트의 정보를 캡처합니다.[로그 모드] [요청 ID] # [이벤트 유형] # [컨텍스트 정보] # [지속 시간](선택사항)
여기서- 로그 모드는 로그가 기록된 부분이 이벤트의 시작 부분인지
또는 종료 부분인지를 나타냅니다. BEGIN은 이벤트의 시작을 나타내며 END는 이벤트의 종료를 나타냅니다.
- 요청 ID는 각 요청에 지정되는 고유 문자열입니다. 이는 특정 요청에 속하는 이벤트를 필터링하는 데 사용할 수 있습니다. 예: requestId=AAY6TalVDTO_AAAAAAAAAAK
- 이벤트 유형은 이벤트 소스에 대한 정보를 제공하며, 그 유형은 다음 표에 제공된 지원되는 이벤트 유형 중 하나입니다. 이벤트 유형은 특정 유형의 이벤트를 필터링하는 데 사용할 수 있습니다. 예: eventType=websphere.servlet.service
- 이벤트의 컨텍스트 정보는 이벤트 유형과 관련된 세부사항을 제공합니다. 이 정보는 이벤트 유형에 따라 달라집니다. 컨텍스트 정보는 여러 섹션을 포함할 수 있으며 | (간격|간격)으로 구분됩니다.
다양한 이벤트 유형의 컨텍스트 정보 예제는 다음 표에 제공되어 있습니다.
- 지속 시간은 이벤트에 소요된 시간을 나타냅니다. 지속 시간은 종료 이벤트 항목에만 표시됩니다. 예: duration=158.283ms
[12/15/14 18:24:29:687 IST] 0000002e EventLogging I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | TradeScenarioServlet # duration=158.283ms
다음 표에는 이벤트 로깅에서 지원하는 이벤트 유형이 나열되어 있습니다. 컴포넌트 | 이벤트 유형 | 컨텍스트 정보 | 예제 |
---|---|---|---|
서블릿 |
websphere.servlet.destroy |
[애플리케이션 이름] | [서블릿 이름] | [경로 정보] | [조회 문자열] |
contextInfo=TradeWeb | /displayQuote.jsp |
세션 |
websphere.session.dbSessionDestroyedByTimeout, websphere.session.getAttribute |
[세션 ID] [세션 ID] | [세션 속성 이름] |
contextInfo=EuitabHZUOD7J2u01HDdAG0 contextInfo=EuitabHZUOD7J2u01HDdAG0 | userID |
JDBC |
websphere.datasource.execute |
[데이터 소스의 JNDI 이름] | [SQL 조회] |
contextInfo=jdbc/TradeDataSource | select * from quoteejb q where q.symbol=? |