특정 이벤트의 구성 또는 값을 자동화하기 위한 사용자 정의
공통 기본 이벤트 컨텐츠 핸들러 또는 템플리트를 작성합니다.
시작하기 전에
컨텐츠 핸들러는 사용하려는 임의의 정책을 기반으로 각 이벤트의
특성 값을 자동으로 설정하는 오브젝트입니다.
공통 기본 이벤트 인프라의 사용을 돕기 위해 다음 컨텐츠 핸들러 클래스가
WebSphere® Application Server에 추가되었습니다.
클래스 이름 |
설명 |
WsContentHandlerImpl |
이 클래스는 특히 WebSphere Application Server
환경에서 사용하기 위한 org.eclipse.hyades.logging.events.cbe.ContentHandler의
구현을 제공합니다. 이 컨텐츠 핸들러는
WebSphere Application Server 런타임의
정보를 사용하여 공통 기본 이벤트를 완료하고, WebSphere Application
Server가 로깅을 위해 공통 기본 이벤트를 완료할 때 내부적으로 사용한 것과 동일한
컨텐츠 핸들러를 사용합니다. |
WsTemplateContentHandlerImpl |
이 클래스는 WsContentHandlerImpl과 동일한 기능을 제공하지만 org.eclipse.hyades.logging.events.cbe.impl.TemplateContentHandlerImpl
클래스를 확장하여 공통 기본 이벤트 템플리트의 사용을 사용으로 설정합니다. 템플리트 데이터가
WsContentHandlerImpl과 동일한 공통 기본 이벤트 필드의 값을 지정하는 경우 템플리트 컨텐츠가 우선순위를 갖습니다. |
이 태스크 정보
일부 상황에서 사용자가 작성하는 모든 이벤트에 대해 일부 이벤트 특성 데이터 세트가 자동으로 설정되게 하려고 합니다. 이 자동화는
변경되지 않는 특정 표준 값(예: 애플리케이션 이름)을
입력하거나, 런타임 환경에서 사용 가능한 정보에 기초하여 일부 특성(예: 작성 시간 또는 스레드 정보)을
설정하는 방법입니다. 컨텐츠 핸들러를 작성하여 특성 데이터를
자동으로 설정할 수 있습니다.
프로시저
- 다음 코드 샘플을 사용하여 CustomContentHandler
클래스를 구현하십시오.
public class CustomContentHandler extends WsContentHandlerImpl {
public CustomContentHandler() {
super();
// TODO Custom initialization code goes here
}
public void completeEvent(CommonBaseEvent cbe) throws CompletionException {
// following code will add WAS content to the Content Base Event
super.completeEvent(cbe);
// TODO Custom content can be added to the Content Base Event here
}
}
- 다음은 CustomTemplateContentHandler 클래스를 구현하는 방법을 보여줍니다.
public class CustomTemplateContentHandler extends WsTemplateContentHandlerImpl {
public CustomTemplateContentHandler() {
super();
// TODO Custom initialization code goes here
}
public void completeEvent(CommonBaseEvent cbe) throws CompletionException {
// following code will add WAS content to the Content Base Event
super.completeEvent(cbe);
// TODO Custom content can be added to the Content Base Event here
}
}
결과
이제 사용자가 지정한 설정을 기반으로 하는 컨텐츠 핸들러 또는 사용자 정의 컨텐츠 핸들러 템플리트를 갖게 됩니다.