我想从日志文件中获取以下字符串,
Name: OnError
Computer:
Operator:
Source Name:
Source GUID:
Execution GUID:
Message: A connection could not be made to the data source with the DataSourceID of 'xyz', Name of 'abc'.
Start Time: 2016-09-29 05:40:08
End Time: 2016-09-29 05:40:08
End Log
我搜索字符串的关键字是OnError
。从字符串OnError
到End Log
,我需要采取并且必须存储在数组中。
请提出您的建议,以便编写上述代码
答案 0 :(得分:0)
您可以使用正则表达式轻松完成
mapper(Apple, appleTable, properties={
"appleBloggers": relationship(Blogger,
secondary=recipeTable.join(blogTable, recipeTable.c.id == blogTable.c.recipeId),
primaryjoin=appleTable.c.id == recipeTable.c.appleId,
secondaryjoin=blogTable.c.bloggerId == bloggerTable.c.id)
})
答案 1 :(得分:0)
JsonWriter writer = new JsonWriter(out, true);
我假设您在此示例中只有一次出现(OnError和End Log)给定模式。如果此模式出现多次,您可以展开它。首先找到包含OnError的行,然后读取直到包含End Log的行。