我想使用Spring批處理將日誌文件的內容導入到數據庫中。Spring批處理:如何處理多行日誌文件
我目前正在使用FlatFileItemReader,但不幸的是有許多日誌條目不能捕獲。的兩個主要問題是:包含多行JSON字符串
線:包含堆棧跟蹤
2012-03-22 11:47:50,596 ERROR main com.meetup.memcached.SockIOPool.createSocket(SockIOPool.java:859): No route to host java.net.NoRouteToHostException: No route to host at sun.nio.ch.Net.connect0(Native Method) at sun.nio.ch.Net.connect(Net.java:364) at sun.nio.ch.Net.connect(Net.java:356) at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:623) at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:92) at com.meetup.memcached.SockIOPool$SockIO.getSocket(SockIOPool.java:1703) at com.meetup.memcached.SockIOPool$SockIO.<init>(SockIOPool.java:1674) at com.meetup.memcached.SockIOPool.createSocket(SockIOPool.java:850) at com.meetup.memcached.SockIOPool.populateBuckets(SockIOPool.java:737) at com.meetup.memcached.SockIOPool.initialize(SockIOPool.java:695)
基本上
2012-03-22 11:47:35,307 DEBUG main someMethod(SomeClass.java:56): Do Something(18,true,null,null,null): my.json = '{
"Foo":"FooValue",
"Bar":"BarValue",
... etc
}'
線,我所需要的FlatFileItemReader繼續讀取,直到它達到下一個時間戳,同時聚合所有行。之前是否有過這樣的事情(在Spring批處理中)
不錯,謝謝... – 2015-01-21 15:09:27