Produced by Araxis Merge on 10/26/2017 10:44:23 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Oct 27 02:44:23 2017 UTC | ||
| 2 | OSCIF_BMS_v2_iter 2_September_2017.zip\BMS_Cand\Source\Sources\BMS.Vista.TestEis\BMS.Utils | Tracer.cs | Wed Oct 18 18:47:02 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 213 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | using Syst em; | |||||
| 2 | using Syst em.Collect ions.Gener ic; | |||||
| 3 | using Syst em.Linq; | |||||
| 4 | using Syst em.Text; | |||||
| 5 | using Syst em.Diagnos tics; | |||||
| 6 | using Syst em.Service Model; | |||||
| 7 | using Syst em.Reflect ion; | |||||
| 8 | using Syst em.Threadi ng; | |||||
| 9 | ||||||
| 10 | namespace BMS.Utils | |||||
| 11 | { | |||||
| 12 | /// <s ummary> | |||||
| 13 | /// Ut ility clas s used to trace exce ptions in custom for mat. | |||||
| 14 | /// </ summary> | |||||
| 15 | public static cl ass Tracer | |||||
| 16 | { | |||||
| 17 | st atic objec t _treadSy nc = new o bject(); | |||||
| 18 | ||||||
| 19 | // / <summary > | |||||
| 20 | // / Writes t he excepti on and all the inner exception s using a custom for mat. | |||||
| 21 | // / </summar y> | |||||
| 22 | // / <param n ame="excep tion">Main exception </param> | |||||
| 23 | pu blic stati c void Tra ceExceptio n(Exceptio n exceptio n) | |||||
| 24 | { | |||||
| 25 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 26 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 27 | { | |||||
| 28 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 29 | } | |||||
| 30 | try | |||||
| 31 | { | |||||
| 32 | lock (_treadSy nc) | |||||
| 33 | { | |||||
| 34 | AppendStar tLine(); | |||||
| 35 | Trace.Writ eLine(exce ption.Mess age); | |||||
| 36 | Type excep tionType = exception .GetType() ; | |||||
| 37 | bool parse Recursive = true; | |||||
| 38 | ||||||
| 39 | //try to t race Fault Exception< T> | |||||
| 40 | if (except ionType.Is GenericTyp e && excep tion is Fa ultExcepti on) | |||||
| 41 | { | |||||
| 42 | Proper tyInfo det ail = exce ptionType. GetPropert ies().Firs tOrDefault (pi => pi. Name == "D etail"); | |||||
| 43 | if (de tail != nu ll) | |||||
| 44 | { | |||||
| 45 | ob ject detai lException = detail. GetValue(e xception, null); | |||||
| 46 | if (detailEx ception != null) | |||||
| 47 | { | |||||
| 48 | parseRec ursive = f alse; | |||||
| 49 | Trace.Wr iteLine(de tailExcept ion.GetTyp e().ToStri ng() | |||||
| 50 | + ": " + detai lException .ToString( )); | |||||
| 51 | } | |||||
| 52 | } | |||||
| 53 | } | |||||
| 54 | while (par seRecursiv e == true && excepti on.InnerEx ception != null) | |||||
| 55 | { | |||||
| 56 | except ion = exce ption.Inne rException ; | |||||
| 57 | Trace. WriteLine( exception. Message); | |||||
| 58 | } | |||||
| 59 | Trace.Writ eLine(exce ption.Stac kTrace); | |||||
| 60 | AppendEndL ine(); | |||||
| 61 | } | |||||
| 62 | } | |||||
| 63 | finally | |||||
| 64 | { | |||||
| 65 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 66 | { | |||||
| 67 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 68 | } | |||||
| 69 | } | |||||
| 70 | } | |||||
| 71 | // / <summary > | |||||
| 72 | // / Traces a service s tart event . | |||||
| 73 | // / </summar y> | |||||
| 74 | // / <param n ame="servi ce">Servic e host.</p aram> | |||||
| 75 | pu blic stati c void Tra ceServiceS tart(Servi ceHostBase service) | |||||
| 76 | { | |||||
| 77 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 78 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 79 | { | |||||
| 80 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 81 | } | |||||
| 82 | try | |||||
| 83 | { | |||||
| 84 | Trac eServiceEv ent(servic e, "starte d"); | |||||
| 85 | } | |||||
| 86 | finally | |||||
| 87 | { | |||||
| 88 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 89 | { | |||||
| 90 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 91 | } | |||||
| 92 | } | |||||
| 93 | } | |||||
| 94 | // / <summary > | |||||
| 95 | // / Traces a service s top event. | |||||
| 96 | // / </summar y> | |||||
| 97 | // / <param n ame="servi ce">Servic e host.</p aram> | |||||
| 98 | pu blic stati c void Tra ceServiceS top(Servic eHostBase service) | |||||
| 99 | { | |||||
| 100 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 101 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 102 | { | |||||
| 103 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 104 | } | |||||
| 105 | try | |||||
| 106 | { | |||||
| 107 | Trac eServiceEv ent(servic e, "stoppe d"); | |||||
| 108 | } | |||||
| 109 | finally | |||||
| 110 | { | |||||
| 111 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 112 | { | |||||
| 113 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 114 | } | |||||
| 115 | } | |||||
| 116 | } | |||||
| 117 | // / <summary > | |||||
| 118 | // / Traces a custom st ring messa ge. | |||||
| 119 | // / </summar y> | |||||
| 120 | // / <param n ame="custo mMessage"> Custom mes sage.</par am> | |||||
| 121 | pu blic stati c void Tra ceMessage( string cus tomMessage ) | |||||
| 122 | { | |||||
| 123 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 124 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 125 | { | |||||
| 126 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 127 | } | |||||
| 128 | try | |||||
| 129 | { | |||||
| 130 | lock (_treadSy nc) | |||||
| 131 | { | |||||
| 132 | AppendStar tLine(); | |||||
| 133 | Trace.Writ eLine(cust omMessage) ; | |||||
| 134 | AppendEndL ine(); | |||||
| 135 | } | |||||
| 136 | } | |||||
| 137 | finally | |||||
| 138 | { | |||||
| 139 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 140 | { | |||||
| 141 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 142 | } | |||||
| 143 | } | |||||
| 144 | } | |||||
| 145 | pr ivate stat ic void Tr aceService Event(Serv iceHostBas e service, string se rviceEvent ) | |||||
| 146 | { | |||||
| 147 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 148 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 149 | { | |||||
| 150 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 151 | } | |||||
| 152 | try | |||||
| 153 | { | |||||
| 154 | lock (_treadSy nc) | |||||
| 155 | { | |||||
| 156 | if (servic e == null || service .BaseAddre sses == nu ll || serv ice.BaseAd dresses.Co unt == 0) | |||||
| 157 | return ; | |||||
| 158 | AppendStar tLine(); | |||||
| 159 | Trace.Writ eLine("Ser vice " + s erviceEven t + ": " + service.B aseAddress es[0].Abso luteUri); | |||||
| 160 | AppendEndL ine(); | |||||
| 161 | } | |||||
| 162 | } | |||||
| 163 | finally | |||||
| 164 | { | |||||
| 165 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 166 | { | |||||
| 167 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 168 | } | |||||
| 169 | } | |||||
| 170 | } | |||||
| 171 | pu blic const string ST ART_LINE = "******** ********** ********** (Thread { 0}) {1:dd- MM-yyyy HH :mm:ss} ** ********** ********** *****"; | |||||
| 172 | pu blic const string EN D_LINE = " ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------"; | |||||
| 173 | ||||||
| 174 | st atic void AppendStar tLine() | |||||
| 175 | { | |||||
| 176 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 177 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 178 | { | |||||
| 179 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 180 | } | |||||
| 181 | try | |||||
| 182 | { | |||||
| 183 | Trac e.WriteLin e(String.F ormat(STAR T_LINE, Th read.Curre ntThread.M anagedThre adId, Date Time.Now)) ; | |||||
| 184 | } | |||||
| 185 | finally | |||||
| 186 | { | |||||
| 187 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 188 | { | |||||
| 189 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 190 | } | |||||
| 191 | } | |||||
| 192 | } | |||||
| 193 | st atic void AppendEndL ine() | |||||
| 194 | { | |||||
| 195 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 196 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 197 | { | |||||
| 198 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 199 | } | |||||
| 200 | try | |||||
| 201 | { | |||||
| 202 | Trac e.WriteLin e(END_LINE ); | |||||
| 203 | } | |||||
| 204 | finally | |||||
| 205 | { | |||||
| 206 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 207 | { | |||||
| 208 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 209 | } | |||||
| 210 | } | |||||
| 211 | } | |||||
| 212 | } | |||||
| 213 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.