public String getFormattedRecord ( RepositoryLogRecord record , Locale locale ) { StringBuilder sb = new StringBuilder ( 300 ) ; //create opening tag for the CBE Event createEventOTag ( sb , record , locale ) ; //add the CBE elements createExtendedElement ( sb , record ) ; createExtendedElement ( sb , "CommonBaseEventLogRecord:sequenceNumber" , "long" , String . valueOf ( record . getSequence ( ) ) ) ; createExtendedElement ( sb , "CommonBaseEventLogRecord:threadID" , "int" , String . valueOf ( record . getThreadID ( ) ) ) ; if ( record . getLoggerName ( ) != null ) { createExtendedElement ( sb , "CommonBaseEventLogRecord:loggerName" , "string" , record . getLoggerName ( ) ) ; } for ( String name : record . getExtensions ( ) . keySet ( ) ) { // Don't report pthreadId here since it is reported as part of the sourceComponentId. if ( ! RepositoryLogRecord . PTHREADID . equals ( name ) ) { createExtendedElement ( sb , record , name ) ; } } if ( headerProps . getProperty ( ServerInstanceLogRecordList . HEADER_VERSION ) != null ) createExtendedElement ( sb , "version" , "string" , headerProps . getProperty ( ServerInstanceLogRecordList . HEADER_VERSION ) ) ; if ( headerProps . getProperty ( ServerInstanceLogRecordList . HEADER_PROCESSID ) != null ) createExtendedElement ( sb , "processId" , "string" , headerProps . getProperty ( ServerInstanceLogRecordList . HEADER_PROCESSID ) ) ; if ( headerProps . getProperty ( ServerInstanceLogRecordList . HEADER_SERVER_NAME ) != null ) createExtendedElement ( sb , "processName" , "string" , headerProps . getProperty ( ServerInstanceLogRecordList . HEADER_SERVER_NAME ) ) ; switch ( record . getLocalizable ( ) ) { case WsLogRecord . REQUIRES_LOCALIZATION : createExtendedElement ( sb , "localizable" , "string" , STR_REQUIRES_LOCALIZATION ) ; //yes break ; case WsLogRecord . REQUIRES_NO_LOCALIZATION : createExtendedElement ( sb , "localizable" , "string" , STR_REQUIRES_NO_LOCALIZATION ) ; //no break ; default : createExtendedElement ( sb , "localizable" , "string" , STR_DEFAULT_LOCALIZATION ) ; //default break ; } createSourceElement ( sb , record ) ; createMessageElement ( sb , record ) ; createSituationElement ( sb ) ; //create closing tag for the CBE Event createEventCTag ( sb ) ; return sb . toString ( ) ; }
Gets a String representation of a log record as a CBEEvent XML element