如何转换ADF移动日志输出体

时间:2013-05-06 06:37:13

标签: oracle-adf

当我调试ADF移动应用程序时,我在终端中写入命令 tail -f /var/log/system.log 。我得到了以下输出。

May 6 11:32:42 evosys-iMacs-iMac.local manager[507]: Obj-C [CH-1, State=created ableToSend=Yes]: Message arrived - VMMessage [
type: Plain[0x00]
prinorty: 2
channelID: -1
messageID: 3
length: 137
body: {41, 44, 46, 4D, 53, 47, 20, 31, 30, 30, 30, 30, 20, 20, 20, 35, 31,
       31, 20, 20, 20, 35, 31, 31, 20, 20, 20, 20, 20, 30, 20, 20, 20, 31,
       30, 31, 7B, 22, 72, 65, 73, 75, 6C, 74, 22, 3A, 5B, 5D, 2C, 22, 64,
       61, 74, 61, 43, 68, 61, 6E, 67, 65, 45, 76, 65, 6E, 74, 22, 3A, 7B,
       22, 76, 61, 72, 69, 61, 62, 6C, 65, 43, 68, 61, 6E, 67, 65, 73, 22,
       3A, 7B, 22, 76, 69, 65, 77, 53, 63, 6F, 70, 65, 22, 3A, 7B, 22, 2E,
       6E, 75, 6C, 6C, 22, 3A, 74, 72, 75, 65, 7D, 7D, 2C, 22, 70, 72, 6F,
       76, 69, 64, 65, 72, 43, 68, 61, 6E, 67, 65, 73, 22, 3A, 7B, 7D, 7D, 7D}
]

我不知道如何将body转换为字符串,

1 个答案:

答案 0 :(得分:1)

我确信更好的awk方式可以做到这一点,但为了快速回答

egrep -o '[[:xdigit:]]{2}[,}]' system.log | while read foo
do
  printf "\x${foo::2}"
done

产量

ADFMSG 10000   511   511     0   101{"result":[],"dataChangeEvent":
{"variableChanges":{"viewScope":{".null":true}},"providerChanges":{}}}