JRas 관리자 및 로거 인스턴스
JRas 확장을 통합, 독립형 또는 결합 모드로 사용할 수 있습니다. 애플리케이션의 구성은 조작 모드에 따라 다양하지만, 메시지 로그 또는 항목 추적에 대한 로거의 사용은 모든 조작 모드에서 동일합니다.
더 이상 사용되지 않음: 이 태스크 및 하위 태스크에서 설명한 JRas 프레임워크는 더 이상 사용되지 않습니다. 그러나 Java™ 로깅을 사용하여 유사한 결과를 얻을 수 있습니다.
통합 모드는 조작의 기본 모드입니다. 이 모드에서, 메시지 및 추적 이벤트는 WebSphere® Application Server 로그로 전송됩니다.
결합 모드에서, 메시지 및 추적 이벤트는 WebSphere Application Server 및 사용자 정의 로그에 기록됩니다.
독립형 모드에서, 메시지 및 추적 이벤트는 사용자 정의 로그에만 기록됩니다.
메시지 및 추적 로거 사용
조작 모드에 상관없이 메시지 및 추적 로거의 사용은 동일합니다.
메시지 로거 사용
메시지 로거는 DefaultMessages
자원 번들을 사용하도록 구성됩니다. 로거가 메시지 API를 사용할 경우,
메시지 키는 메시지 로거로 전달되어야 합니다.
msgLogger.message(RASIMessageEvent.TYPE_WARNING, this, methodName, "MSG_KEY_00"); ... msgLogger.message(RASIMessageEvent.TYPE_WARN, this, methodName, "MSG_KEY_01", "some string");
메시지 로거가
msg API를 사용할 경우에는 새로운 자원 번들 이름을 지정할 수 있습니다.
msgLogger.msg(RASIMessageEvent.TYPE_ERR, this, methodName, "ALT_MSG_KEY_00", "alternateMessageFile");
텍스트 메시지도
로그할 수 있습니다. textMessage API를 사용할 경우,
메시지 형식화는 수행되지 않습니다.
msgLogger.textMessage(RASIMessageEvent.TYPE_INFO, this, methodName,"String and Integer", "A String", new Integer(5));
추적 로거 사용
추적은 보통 사용되지 않기 때문에
성능 상의 이유로 추적 메소드를 감시하십시오.
private void methodX(int x, String y, Foo z)
{
// trace an entry point. Use the guard to make sure tracing is enabled.
Do this checking before you gather parameters to trace.
if (trcLogger.isLoggable(RASITraceEvent.TYPE_ENTRY_EXIT) {
// I want to trace three parameters, package them up in an Object[]
Object[] parms = {new Integer(x), y, z};
trcLogger.entry(RASITraceEvent.TYPE_ENTRY_EXIT, this, "methodX", parms);
}
... logic
// a debug or verbose trace point
if (trcLogger.isLoggable(RASITraceEvent.TYPE_MISC_DATA) {
trcLogger.trace(RASITraceEvent.TYPE_MISC_DATA, this, "methodX" "reached here");
}
...
// Another classification of trace event. An important state change is
detected, so a different trace type is used.
if (trcLogger.isLoggable(RASITraceEvent.TYPE_SVC) {
trcLogger.trace(RASITraceEvent.TYPE_SVC, this, "methodX", "an important event");
}
...
// ready to exit method, trace. No return value to trace
if (trcLogger.isLoggable(RASITraceEvent.TYPE_ENTRY_EXIT)) {
trcLogger.exit(RASITraceEvent.TYPE_ENTRY_EXIT, this, "methodX");
}
}