Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Counting blocks of text

Reply
Thread Tools

Counting blocks of text

 
 
laredotornado
Guest
Posts: n/a
 
      11-02-2010
Hi,

I'm using Perl 5.8.9 for Mac 10.6.3. I am trying to parse log files
(log4j v1.2.4) and count identical blocks of text in my file. So
below is an example of the kinds of things I see in my log file
(notice that some blocks of text span several lines). I would like to
get identify the similar blocks of text and get a count of how many
times each occurs in the file. Any ideas how I can do this?

Thanks, - Dave


=====================example contents of a file =====================
ERROR com.myco.servlet.summer.SummerServlet - db gave null for
galleryId: 4
ERROR com.myco.servlet.common.SimpleLeadTrackerServlet - LEAD
INSERTION FAILED: Laughlin null null
com.ibatis.common.jdbc.exception.NestedSQLExceptio n:
--- The error occurred in campaignQueries.xml.
--- The error occurred while preparing the mapped statement for
execution.
--- Check the Campaign.getXmlBannerForSrcId.
--- Cause: java.sql.SQLException: Invalid parameter object type.
Expected 'java.lang.Integer' but found 'java.util.HashMap'.
at
com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.executeQueryWithCallback(MappedStatement. java:
201)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.executeQueryForList(MappedStatement.java:
139)
at
com.ibatis.sqlmap.engine.mapping.statement.Caching Statement.executeQueryForList(CachingStatement.jav a:
97)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelega te.queryForList(SqlMapExecutorDelegate.java:
567)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelega te.queryForList(SqlMapExecutorDelegate.java:
541)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.qu eryForList(SqlMapSessionImpl.java:
11
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.que ryForList(SqlMapClientImpl.java:
94)
at com.myco.database.DataInterface.doOperation(DataIn terface.java:
180)
at com.myco.database.DataInterface.doFullOperation(Da taInterface.java:
15
at com.myco.database.DataInterface.getResults(DataInt erface.java:132)
at com.myco.database.DataInterface.getResults(DataInt erface.java:357)
at com.myco.database.DataInterface.getResults(DataInt erface.java:349)
at
com.myco.servlet.common.SimpleLeadTrackerServlet.p rocessRequest(SimpleLeadTrackerServlet.java:
129)
at
com.myco.servlet.common.SimpleLeadTrackerServlet.d oPost(SimpleLeadTrackerServlet.java:
250)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at com.myco.filter.RecordPageFilter.doFilter(RecordPa geFilter.java:
35)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at
org.springframework.web.filter.CharacterEncodingFi lter.doFilterInternal(CharacterEncodingFilter.java :
8
at
org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:
76)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :344)
at
org.springframework.security.web.access.intercept. FilterSecurityInterceptor.invoke(FilterSecurityInt erceptor.java:
110)
at
org.springframework.security.web.access.intercept. FilterSecurityInterceptor.doFilter(FilterSecurityI nterceptor.java:
84)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.access.ExceptionT ranslationFilter.doFilter(ExceptionTranslationFilt er.java:
9
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.session.SessionMa nagementFilter.doFilter(SessionManagementFilter.ja va:
95)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.authentication.An onymousAuthenticationFilter.doFilter(AnonymousAuth enticationFilter.java:
79)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.servletapi.Securi tyContextHolderAwareRequestFilter.doFilter(Securit yContextHolderAwareRequestFilter.java:
55)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.savedrequest.Requ estCacheAwareFilter.doFilter(RequestCacheAwareFilt er.java:
36)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.authentication.Ab stractAuthenticationProcessingFilter.doFilter(Abst ractAuthenticationProcessingFilter.java:
18
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.authentication.lo gout.LogoutFilter.doFilter(LogoutFilter.java:
106)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.context.SecurityC ontextPersistenceFilter.doFilter(SecurityContextPe rsistenceFilter.java:
80)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.FilterChainProxy. doFilter(FilterChainProxy.java:
150)
at
org.springframework.web.filter.DelegatingFilterPro xy.invokeDelegate(DelegatingFilterProxy.java:
237)
at
org.springframework.web.filter.DelegatingFilterPro xy.doFilter(DelegatingFilterProxy.java:
167)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:
29
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:
190)
at org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:
291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:769)
at
org.apache.jk.common.ChannelSocket.processConnecti on(ChannelSocket.java:
69
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: Invalid parameter object type.
Expected 'java.lang.Integer' but found 'java.util.HashMap'.
at
com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.validateParameter(MappedStatement.java:
245)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.executeQueryWithCallback(MappedStatement. java:
167)
... 62 more
ERROR com.myco.servlet.common.SimpleLeadTrackerServlet - LEAD
INSERTION FAILED: Laughlin null null
com.ibatis.common.jdbc.exception.NestedSQLExceptio n:
--- The error occurred in campaignQueries.xml.
--- The error occurred while preparing the mapped statement for
execution.
--- Check the Campaign.getXmlBannerForSrcId.
--- Cause: java.sql.SQLException: Invalid parameter object type.
Expected 'java.lang.Integer' but found 'java.util.HashMap'.
at
com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.executeQueryWithCallback(MappedStatement. java:
201)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.executeQueryForList(MappedStatement.java:
139)
at
com.ibatis.sqlmap.engine.mapping.statement.Caching Statement.executeQueryForList(CachingStatement.jav a:
97)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelega te.queryForList(SqlMapExecutorDelegate.java:
567)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelega te.queryForList(SqlMapExecutorDelegate.java:
541)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.qu eryForList(SqlMapSessionImpl.java:
11
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.que ryForList(SqlMapClientImpl.java:
94)
at com.myco.database.DataInterface.doOperation(DataIn terface.java:
180)
at com.myco.database.DataInterface.doFullOperation(Da taInterface.java:
15
at com.myco.database.DataInterface.getResults(DataInt erface.java:132)
at com.myco.database.DataInterface.getResults(DataInt erface.java:357)
at com.myco.database.DataInterface.getResults(DataInt erface.java:349)
at
com.myco.servlet.common.SimpleLeadTrackerServlet.p rocessRequest(SimpleLeadTrackerServlet.java:
129)
at
com.myco.servlet.common.SimpleLeadTrackerServlet.d oPost(SimpleLeadTrackerServlet.java:
250)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at com.myco.filter.RecordPageFilter.doFilter(RecordPa geFilter.java:
35)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at
org.springframework.web.filter.CharacterEncodingFi lter.doFilterInternal(CharacterEncodingFilter.java :
8
at
org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:
76)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :344)
at
org.springframework.security.web.access.intercept. FilterSecurityInterceptor.invoke(FilterSecurityInt erceptor.java:
110)
at
org.springframework.security.web.access.intercept. FilterSecurityInterceptor.doFilter(FilterSecurityI nterceptor.java:
84)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.access.ExceptionT ranslationFilter.doFilter(ExceptionTranslationFilt er.java:
9
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.session.SessionMa nagementFilter.doFilter(SessionManagementFilter.ja va:
95)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.authentication.An onymousAuthenticationFilter.doFilter(AnonymousAuth enticationFilter.java:
79)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.servletapi.Securi tyContextHolderAwareRequestFilter.doFilter(Securit yContextHolderAwareRequestFilter.java:
55)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.savedrequest.Requ estCacheAwareFilter.doFilter(RequestCacheAwareFilt er.java:
36)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.authentication.Ab stractAuthenticationProcessingFilter.doFilter(Abst ractAuthenticationProcessingFilter.java:
18
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.authentication.lo gout.LogoutFilter.doFilter(LogoutFilter.java:
106)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.context.SecurityC ontextPersistenceFilter.doFilter(SecurityContextPe rsistenceFilter.java:
80)
at org.springframework.security.web.FilterChainProxy
$VirtualFilterChain.doFilter(FilterChainProxy.java :356)
at
org.springframework.security.web.FilterChainProxy. doFilter(FilterChainProxy.java:
150)
at
org.springframework.web.filter.DelegatingFilterPro xy.invokeDelegate(DelegatingFilterProxy.java:
237)
at
org.springframework.web.filter.DelegatingFilterPro xy.doFilter(DelegatingFilterProxy.java:
167)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:
29
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:
190)
at org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:
291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:769)
at
org.apache.jk.common.ChannelSocket.processConnecti on(ChannelSocket.java:
69
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: Invalid parameter object type.
Expected 'java.lang.Integer' but found 'java.util.HashMap'.
at
com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.validateParameter(MappedStatement.java:
245)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.executeQueryWithCallback(MappedStatement. java:
167)
... 62 more
ERROR com.myco.servlet.search.GoogleMiniSearchProxy - search(String
searchParams): Exception Thrown.
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl .java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSoc ketImpl.java:
195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.j ava:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.j ava:366)
at java.net.Socket.connect(Socket.java:525)
at java.net.Socket.connect(Socket.java:475)
at sun.net.NetworkClient.doConnect(NetworkClient.java :163)
at sun.net.http://www.http.HttpClient.openServe...lient.java:394)
at sun.net.http://www.http.HttpClient.openServe...lient.java:529)
at sun.net.www.http.HttpClient.<init>(HttpClient.java :233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at
sun.net.http://www.protocol.http.HttpURLConn...nnection.java:
860)
at
sun.net.http://www.protocol.http.HttpURLConn...nnection.java:
801)
at
sun.net.http://www.protocol.http.HttpURLConn...nnection.java:
726)
at
sun.net.http://www.protocol.http.HttpURLConn...nnection.java:
1049)
at
com.myco.servlet.search.GoogleMiniSearchProxy.sear ch(GoogleMiniSearchProxy.java:
8
at
com.myco.servlet.search.GoogleMiniSearchProxy.sear ch(GoogleMiniSearchProxy.java:
70)
at
com.myco.servlet.search.GoogleProxyServlet.doPost( GoogleProxyServlet.java:
40)
at
com.myco.servlet.search.GoogleProxyServlet.doGet(G oogleProxyServlet.java:
33)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at com.myco.filter.RecordPageFilter.doFilter(RecordPa geFilter.java:
35)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:
29
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:
190)
at org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:
291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:769)
at
org.apache.jk.common.ChannelSocket.processConnecti on(ChannelSocket.java:
69
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
ERROR com.myco.servlet.search.GoogleMiniSearchProxy -
search(HttpServletRequest request): Exception Thrown.
java.lang.Exception: Site search not available. Please try again
later.
at
com.myco.servlet.search.GoogleMiniSearchProxy.sear ch(GoogleMiniSearchProxy.java:
100)
at
com.myco.servlet.search.GoogleMiniSearchProxy.sear ch(GoogleMiniSearchProxy.java:
70)
at
com.myco.servlet.search.GoogleProxyServlet.doPost( GoogleProxyServlet.java:
40)
at
com.myco.servlet.search.GoogleProxyServlet.doGet(G oogleProxyServlet.java:
33)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at com.myco.filter.RecordPageFilter.doFilter(RecordPa geFilter.java:
35)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:
29
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:
190)
at org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:
291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:769)
at
org.apache.jk.common.ChannelSocket.processConnecti on(ChannelSocket.java:
69
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
ERROR com.myco.servlet.search.GoogleProxyServlet -
post(request,response)
java.lang.Exception: Site search not available. Please try again
later.
at
com.myco.servlet.search.GoogleMiniSearchProxy.sear ch(GoogleMiniSearchProxy.java:
74)
at
com.myco.servlet.search.GoogleProxyServlet.doPost( GoogleProxyServlet.java:
40)
at
com.myco.servlet.search.GoogleProxyServlet.doGet(G oogleProxyServlet.java:
33)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at com.myco.filter.RecordPageFilter.doFilter(RecordPa geFilter.java:
35)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:
29
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:
190)
at org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:
291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:769)
at
org.apache.jk.common.ChannelSocket.processConnecti on(ChannelSocket.java:
69
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
ERROR com.myco.servlet.common.LeadTrackerServlet2 - [processRequest]
[sourceURL: not set]
ERROR com.myco.servlet.common.LeadTrackerServlet2 - [processRequest]
[LEAD INSERTION FAILED: ]
com.ibatis.common.jdbc.exception.NestedSQLExceptio n:
--- The error occurred in campaignQueries.xml.
--- The error occurred while preparing the mapped statement for
execution.
--- Check the Campaign.getXmlBannerForSrcId.
--- Cause: java.sql.SQLException: Invalid parameter object type.
Expected 'java.lang.Integer' but found 'java.util.HashMap'.
at
com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.executeQueryWithCallback(MappedStatement. java:
201)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.executeQueryForList(MappedStatement.java:
139)
at
com.ibatis.sqlmap.engine.mapping.statement.Caching Statement.executeQueryForList(CachingStatement.jav a:
97)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelega te.queryForList(SqlMapExecutorDelegate.java:
567)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelega te.queryForList(SqlMapExecutorDelegate.java:
541)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.qu eryForList(SqlMapSessionImpl.java:
11
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.que ryForList(SqlMapClientImpl.java:
94)
at com.myco.database.DataInterface.doOperation(DataIn terface.java:
180)
at com.myco.database.DataInterface.doFullOperation(Da taInterface.java:
15
at com.myco.database.DataInterface.getResults(DataInt erface.java:132)
at com.myco.database.DataInterface.getResults(DataInt erface.java:357)
at com.myco.database.DataInterface.getResults(DataInt erface.java:349)
at
com.myco.servlet.common.LeadTrackerServlet2.proces sRequest(LeadTrackerServlet2.java:
105)
at
com.myco.servlet.common.LeadTrackerServlet2.doPost (LeadTrackerServlet2.java:
254)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at com.myco.filter.RecordPageFilter.doFilter(RecordPa geFilter.java:
35)
at
org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:
127)
at
org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:
29
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyo teHandler.java:
190)
at org.apache.jk.common.HandlerRequest.invoke(Handler Request.java:
291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelS ocket.java:769)
at
org.apache.jk.common.ChannelSocket.processConnecti on(ChannelSocket.java:
69
at org.apache.jk.common.ChannelSocket
$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: Invalid parameter object type.
Expected 'java.lang.Integer' but found 'java.util.HashMap'.
at
com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.validateParameter(MappedStatement.java:
245)
at
com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.executeQueryWithCallback(MappedStatement. java:
167)
... 33 more
====================end example contents of a file ===================
 
Reply With Quote
 
 
 
 
J. Gleixner
Guest
Posts: n/a
 
      11-02-2010
laredotornado wrote:
> Hi,
>
> I'm using Perl 5.8.9 for Mac 10.6.3. I am trying to parse log files
> (log4j v1.2.4) and count identical blocks of text in my file. So
> below is an example of the kinds of things I see in my log file
> (notice that some blocks of text span several lines). I would like to
> get identify the similar blocks of text and get a count of how many
> times each occurs in the file. Any ideas how I can do this?


>
> =====================example contents of a file =====================
> ERROR com.myco.servlet.summer.SummerServlet - db gave null for
> galleryId: 4
> ERROR com.myco.servlet.common.SimpleLeadTrackerServlet - LEAD
> INSERTION FAILED: Laughlin null null
> com.ibatis.common.jdbc.exception.NestedSQLExceptio n:

[... removed hundreds of useless errors... ]

> at
> com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.executeQueryWithCallback(MappedStatement. java:
> 167)
> ... 33 more

You post hundreds of lines of errors, and don't include the last 33..
Very thoughtful. Next time, there's no need to post that many lines,
just post a few, showing different errors.

You don't say what you have already tried, but before you start
to write the code, first you need to define what you want to look
for in the file, that would constitute an error. e.g. does every
error start with 'ERROR '??, Does it start with a capital
letter?, etc.

Then you have to open the file and look for when that happens,
and keep track of the error and how many times it happened.

There are different ways to do it, but in general you'd:

open the file.
while you read the file, possibly line by line....
if the line contains the indicator of a new error.
if there was already a previous error that was found, then
store that previous, error.. maybe in a hash, and
increment the count.. e.g. $hash{ $error }++;
store the line as an error. $error = $_
else append the line to the previous error e.g. $error .= $_
close the file.
Be sure to capture the last error.. $hash{ $error }++;

Iterate through the keys in %hash, which are really the text of the
error, to find the error and how many times it occurred.

perldoc perlopentut
perldoc perlretut
perldoc -q 'How do I process an entire hash'


 
Reply With Quote
 
 
 
 
sln@netherlands.com
Guest
Posts: n/a
 
      11-03-2010
On Tue, 02 Nov 2010 10:32:40 -0500, "J. Gleixner" <(E-Mail Removed)> wrote:

>laredotornado wrote:
>> Hi,
>>
>> I'm using Perl 5.8.9 for Mac 10.6.3. I am trying to parse log files
>> (log4j v1.2.4) and count identical blocks of text in my file. So
>> below is an example of the kinds of things I see in my log file
>> (notice that some blocks of text span several lines). I would like to
>> get identify the similar blocks of text and get a count of how many
>> times each occurs in the file. Any ideas how I can do this?

>
>>
>> =====================example contents of a file =====================
>> ERROR com.myco.servlet.summer.SummerServlet - db gave null for
>> galleryId: 4
>> ERROR com.myco.servlet.common.SimpleLeadTrackerServlet - LEAD
>> INSERTION FAILED: Laughlin null null
>> com.ibatis.common.jdbc.exception.NestedSQLExceptio n:

>[... removed hundreds of useless errors... ]
>
>> at
>> com.ibatis.sqlmap.engine.mapping.statement.MappedS tatement.executeQueryWithCallback(MappedStatement. java:
>> 167)
>> ... 33 more

>You post hundreds of lines of errors, and don't include the last 33..
>Very thoughtful. Next time, there's no need to post that many lines,
>just post a few, showing different errors.
>
>You don't say what you have already tried, but before you start
>to write the code, first you need to define what you want to look
>for in the file, that would constitute an error. e.g. does every
>error start with 'ERROR '??, Does it start with a capital
>letter?, etc.
>
>Then you have to open the file and look for when that happens,
>and keep track of the error and how many times it happened.
>
>There are different ways to do it, but in general you'd:
>
>open the file.
>while you read the file, possibly line by line....
> if the line contains the indicator of a new error.
> if there was already a previous error that was found, then
> store that previous, error.. maybe in a hash, and
> increment the count.. e.g. $hash{ $error }++;
> store the line as an error. $error = $_
> else append the line to the previous error e.g. $error .= $_
>close the file.
>Be sure to capture the last error.. $hash{ $error }++;
>
>Iterate through the keys in %hash, which are really the text of the
>error, to find the error and how many times it occurred.
>
>perldoc perlopentut
>perldoc perlretut
>perldoc -q 'How do I process an entire hash'
>


You may want to add some bigger indenting to separate
the apparent inner if/else from the apparent outer
if/else. There is only one else.

> if the line contains the indicator of a new error.
>
> if there was already a previous error that was found, then
> store that previous, error.. maybe in a hash, and
> increment the count.. e.g. $hash{ $error }++;
> store the line as an error. $error = $_
>
> else
> append the line to the previous error e.g. $error .= $_


Still, ERROR
...
...
to ERROR

will consume the entire log file as chopped up hash keys.

-sln
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Methods and blocks - not that clear when blocks passed into Steven Taylor Ruby 9 04-27-2009 08:46 AM
counting up instead of counting down edwardfredriks Javascript 6 09-07-2005 03:30 PM
"Building Blocks" are "Application Blocks" Arjen ASP .Net 3 02-27-2005 01:06 AM
procs/blocks - blocks with procs, blocks with blocks? matt Ruby 1 08-06-2004 01:33 AM



Advertisments