现有的 ILog 接口和现有的 RAD LoggingUtil 检测同时支持记录到 IBM(R) 公共记录插件组件。提供了一些将现有格式记录映射到公共基本事件格式的处理程序。公共基本事件日志记录将被记录到 eclipse\workspace\.metadata 目录中的公共记录日志文件(CommonBaseEvents.xml)。
下表显示了从 IStatus 格式到 CommonBaseEvent 格式的映射:
IStatus 属性 | CommonBaseEvent 属性 |
---|---|
代码 |
ExtendedDataElement.Name = "Code" ExtendedDataElements.Type = "integer" ExtendedDataElement.Values[0] = <Code> |
异常 |
ExtendedDataElement.Name = "Throwable" ExtendedDataElement.Type = "stringArray" ExtendedDataElement.Values[0] = <Throwable's class name>[: <Throwable's localized message>] ExtendedDataElement.Values[1...n] = <Throwable's stackTraceElement[0...(n - 1)]> [ExtendedDataElement.Children[0] = <Throwable's cause>] 其中: ExtendedDataElement.Children[0].Name = "Cause"ExtendedDataElement.Children[0].Type = "stringArray" ExtendedDataElement.Children[0].Values[0] = <cause's class name>[: <cause's localized message> ExtendedDataElement.Children[0].Values[1...n] = <cause's stackTraceElement[0...(n - 1)]> [ExtendedDataElement.Children[0].Children[0] = <cause's cause>] |
消息 | Msg |
插件 |
SourceComponentId.Application = "Common Logging" SourceComponentId.Location = <local host's IPv4 IP address> or "127.0.0.1" SourceComponentId.LocationType = "IPV4" SourceComponentId.Component = <Plugin> SourceComponentId.SubComponent = "Log" SourceComponentId.ComponentIDType = "Application" SourceComponentId.ComponetType = "Eclipse Plugins" |
严重性 | Severity = <Severity>(请参阅映射表) |
Children[0...n] | ExtendedDataElement[0...n].Name = <Children<n>.Plugin> ExtendedDataElements[0...n].Type = "string" ExtendedDataElement[0...n].Children[0...m] = <Children<n>.Code> ExtendedDataElement[0...n].Children[0...m] = <Children<n>.Exception> ExtendedDataElement[0...n].Children[0...m] = <Children<n>.Message> ExtendedDataElement[0...n].Children[0...m] = <Children<n>.Severity> ExtendedDataElement[0...n].Children[0...m] = <Children<n>.Children> |
将对每个映射自动填充下列 CommonBaseEvent 属性:
CommonBaseEvent 属性 | 值 |
---|---|
CreationTime | 当前时间(以毫秒计) |
GlobalInstanceId | 唯一 GUID |
Situation | Situation.CategoryName = "ReportSituation" Situation.SituationType.ReasoningScope = "INTERNAL" Situation.SituationType.ReportCategory = "LOG/TRACE" |
下表显示了 IStatus 严重性属性与 CommonBaseEvent 严重性属性之间的映射:
IStatus 严重性 | CommonBaseEvent 严重性 |
---|---|
正常 |
9 |
信息 | 19 |
警告 | 49 |
错误 | 69 |
取消 | 70 |
下表显示了从 CommonBaseEvent 严重性到 IStatus 严重性的映射:
CommonBaseEvent 严重性范围 | IStatus 严重性 |
---|---|
0-10 | 正常 |
11-19 | 信息 |
20-49 | 警告 |
50-69 | 错误 |
70 | 取消 |
下表显示了从异常到 CommonBaseEvent 属性的映射:
IStatus 属性 | CommonBaseEvent 属性 |
---|---|
异常 |
ExtendedDataElement.Name = "Throwable" ExtendedDataElement.Type = "stringArray" ExtendedDataElement.Values[0] = <Throwable's class name>[: <Throwable's localized message>] ExtendedDataElement.Values[1...n] = <Throwable's stackTraceElement[0...(n - 1)]> [ExtendedDataElement.Children[0] = <Throwable's cause>] 其中: ExtendedDataElement.Children[0].Name = "Cause"ExtendedDataElement.Children[0].Type = "stringArray" ExtendedDataElement.Children[0].Values[0] = <cause's class name>[: <cause's localized message>] ExtendedDataElement.Children[0].Values[1...n] = <cause's stackTraceElement[0...(n - 1)]> [ExtendedDataElement.Children[0].Children[0] = <cause's cause>] |
注意:使用如上所示的同一映射将 Causal Throwables 递归转换为 ExtendedDataElements。
(C) Copyright IBM Corporation 2006. All Rights Reserved.