如何使用Notepad++快速整理擠在一起的CallStack資訊(將分行符號作為被替換的內容)

來源:互聯網
上載者:User

問題描述

=====================

經常需要在SharePoint的ULS日誌中撈取一些帶有callstack的資訊, 而且需要把callstack展開細細查看. 然而, ULS log中的callstack是擠在一起的, 查看起來很不方便.

筆者原來一直手工添加分行符號, 但是近期這類工作實在有點多, 於是開始想辦法了.

 

問題舉例, 筆者從ULS log中撈到這個CallStack,

Error while executing web part: Microsoft.BusinessData.Infrastructure.BdcException: The shim execution failed unexpectedly - Target application not found (application id: AdventureApp).. ---> Microsoft.Office.SecureStoreService.Server.SecureStoreServiceTargetApplicationNotFoundException: Target application not found (application id: AdventureApp).     at Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplicationProxy.Execute[T](String operationName, Boolean validateCanary, ExecuteDelegate`1 operation)     at Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplicationProxy.GetRestrictedCredentials(Guid rawPartitionId, String applicationId)     at Microsoft.Office.SecureStoreService.Server.SecureStoreProvider.GetRestrictedCredentials(String appId)     at Microsoft....
...SharePoint.BusinessData.SystemSpecific.Db.DbConnectionManager.GetConnection()     at Microsoft.SharePoint.BusinessData.SystemSpecific.Db.DbSystemUtility.ExecuteStatic(IMethodInstance methodInstance, ILobSystemInstance lobSystemInstance, Object[] args, IExecutionContext context)     at Microsoft.SharePoint.BusinessData.Runtime.DataClassRuntime.ExecuteInternalWithAuthNFailureRetry(ISystemUtility systemUtility, IMethodInstance methodInstanceToExecute, IMethod methodToExecute, ILobSystemInstance lobSystemInstance, ILobSystem lobSystem, IParameterCollection nonReturnParameters, Object[] overrideArgs)     at Microsoft.SharePoint.BusinessData.Runtime.DataClassRuntime.ExecuteInternal(IDataClass thisDataClass, ILobSystemInstance lobSystemInstance, ILobSystem lobSystem, IMethodInstance methodInstanc...
...eToExecute, IMethod methodToExecute, IParameterCollection nonReturnParameters, Object[]& overrideArgs)     --- End of inner exception stack trace ---     at Microsoft.SharePoint.BusinessData.Runtime.DataClassRuntime.ExecuteInternal(IDataClass thisDataClass, ILobSystemInstance lobSystemInstance, ILobSystem lobSystem, IMethodInstance methodInstanceToExecute, IMethod methodToExecute, IParameterCollection nonReturnParameters, Object[]& overrideArgs)     at Microsoft.SharePoint.BusinessData.Runtime.EntityRuntime.ExecuteInternal(IDataClass thisDataClass, ILobSystemInstance lobSystemInstance, ILobSystem lobSystem, IMethodInstance methodInstanceToExecute, IMethod methodToExecute, IParameterCollection nonReturnParameters, Object[]& overrideArgs, IFilterCollection filters)     at Microsoft.SharePoin...
...t.BusinessData.Runtime.EntityRuntime.ExecuteFiltered(IEntity this, IFilterCollection filterCollection, IMethodInstance methodInstanceToExecute, ILobSystemInstance lobSystemInstance)     at Microsoft.SharePoint.BusinessData.Runtime.EntityRuntime.<FindFiltered>b__3(IEntity e, IMethodInstance mi, IFilterCollection fc, ILobSystemInstance lsi)     at Microsoft.SharePoint.BusinessData.Runtime.EntityInstanceEnumeratorFactory.CreateEntityInstanceEnumerator(IEntity entity, IMethodInstance methodInstance, IFilterCollection filters, ILobSystemInstance lobSystemInstance, ExecutionCallBack executionCallBack)     at Microsoft.SharePoint.BusinessData.MetadataModel.Static.Entity.FindFiltered(IFilterCollection filterCollection, String finderName, ILobSystemInstance lobSystemInstance)     at Microsoft.Share...
...Point.SPListDataSource.GetEntityInstanceEnumerator(XmlNode xnMethodAndFilters)     at Microsoft.SharePoint.SPListDataSource.GetFilteredEntityInstancesInternal(XmlDocument xdQueryView, Boolean fFormatDates, Boolean fUTCToLocal, String firstRowId, Boolean fBackwardsPaging, String& bdcidFirstRow, String& bdcidNextPageRow, List`1& lstColumnNames, Dictionary`2& dictColumnsUsed, List`1& mapRowOrdering, List`1& lstEntityData)     at Microsoft.SharePoint.SPListDataSource.GetFilteredEntityInstances(XmlDocument xdQueryView, Boolean fFormatDates, Boolean fUTCToLocal, String firstRowId, Boolean fBackwardsPaging, String& bdcidFirstRow, String& bdcidNextPageRow, List`1& lstColumnNames, Dictionary`2& dictColumnsUsed, List`1& mapRowOrdering, List`1& lstEntityData)     at Microsoft.SharePoint.SPListItemCol...
...lection.EnsureEntityDataViewAndOrdering(String& bdcidFirstRow, String& bdcidNextPageFirstRow)     at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()     at Microsoft.SharePoint.SPListItemCollection.get_Count()     at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments, String aggregateString, Boolean wantReturn, BaseXsltListWebPart webpart, SPListItem& listItem, SPListItemCollection& listItems, String[]& fieldList)     at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigatorInternal()     at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator()     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)

研究

=====================

在Notepad++中建立一個檔案, 隨便輸入幾行文字

 

點擊下面的選項

 

結果如下, 顯然CR, LF是分行符號.

 

使用CR, LF, Notepad++作為關鍵字, 經過搜尋, 在Notepad++的官網上找到了如下的文字:

Ctrl+H with Extended option selected instead of Regexp. Search for "\r\n", or whatever your OS uses, and replace with what you need. It will replace the newline characters with what you entered. Note that Windows uses CR-LF newlines (\r\n), old Mac uses CR (\r) and Unix uses LF (\n). You can use View -> Show Symbol -> Show End Of Line to see which characters your file uses - files from other OSes may not behave as you expect because they have a different newline type.

Some examples: - To add a string to the end of all lines in Windows, in Ctrl+H with Extended mode enabled, replace \r\n with string\r\n - To add a string to the beginning of all lines in windows, in Ctrl+H with Extended mode enabled, replace \r\n with \r\nstring - To remove extra blank lines in windows, in Ctrl+H with Extended mode enabled, replace \r\n\r\n with \r\n - To remove all newlines, in Ctrl+H with Extended mode enabled, replace \r\n with nothing.

 

解決方案

=====================

使用Notepad++, 將內容貼入:

 

呼出替換對話方塊, 將<at>替換為<\r\nat>, 不包括角括弧.

 

結果如下:

 

就用這個技巧作為開端吧, 善用notepad++, 讓工作效率疾馳如飛.

 

參考資料

=====================

How To Replace Line Ends, thus changing the line layout

http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Replacing_Newlines

Replace a "comma space" with a new line in notepad++

http://pressf1.co.nz/showthread.php?t=91763

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.