Produced by Araxis Merge on 6/20/2018 10:24:21 AM Central 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 | CCRS.zip\CCRS\Reports-Sprint_5.zip\Reports-Sprint_5-aa03f94869cda45ee08ca75641e61a7376f2c2a5\CCRSBaseHelper\src\main\java\gov\va\ccrs\helpers | LogHelper.java | Fri Mar 30 15:47:12 2018 UTC |
2 | CCRS.zip\CCRS\Reports-Sprint_5.zip\Reports-Sprint_5-aa03f94869cda45ee08ca75641e61a7376f2c2a5\CCRSBaseHelper\src\main\java\gov\va\ccrs\helpers | LogHelper.java | Fri Jun 15 13:12:24 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 232 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
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 | package go v.va.ccrs. helpers; | |
2 | ||
3 | import jav a.util.Dat e; | |
4 | ||
5 | import org .apache.lo g4j.Level; | |
6 | import org .apache.lo g4j.Logger ; | |
7 | import org .apache.lo g4j.Priori ty; | |
8 | ||
9 | /** | |
10 | * | |
11 | * Helper to write i nto Log fi le using L og4J | |
12 | * | |
13 | * @author PII | |
14 | * @versio n 1 | |
15 | * @since 11/22/2017 | |
16 | * | |
17 | */ | |
18 | public cla ss LogHelp er | |
19 | { | |
20 | privat e static L ogger _log = null; | |
21 | privat e static b oolean _is Debug = fa lse; | |
22 | ||
23 | /** | |
24 | * | |
25 | * Sta tic Constr uctor | |
26 | * | |
27 | * Loa ds and Con figures Lo g4J | |
28 | * | |
29 | */ | |
30 | static | |
31 | { | |
32 | _l og = Logge r.getLogge r(LogHelpe r.class); | |
33 | _i sDebug = j ava.lang.m anagement. Management Factory.ge tRuntimeMX Bean().get InputArgum ents().toS tring().in dexOf("-ag entlib:jdw p") > 0; | |
34 | } | |
35 | ||
36 | /** | |
37 | * | |
38 | * Wri tes text m essage int o log depe nding on t he Log Lev el set in the Log4J | |
39 | * pro perties fi le | |
40 | * | |
41 | * @pa ram level | |
42 | * @pa ram messag e | |
43 | * @th rows Excep tion | |
44 | */ | |
45 | public static vo id Log(Lev el level, String mes sage) thro ws Excepti on | |
46 | { | |
47 | tr y | |
48 | { | |
49 | if (leve l == Level .ALL || le vel.toInt( ) >= Prior ity.FATAL_ INT) | |
50 | { | |
51 | _log .fatal(mes sage); | |
52 | } | |
53 | else if (level == Level.ALL || level.t oInt() >= Priority.E RROR_INT) | |
54 | { | |
55 | _log .error(mes sage); | |
56 | } | |
57 | else if (level == Level.ALL || level.t oInt() >= Priority.W ARN_INT) | |
58 | { | |
59 | _log .warn(mess age); | |
60 | } | |
61 | else if (level == Level.ALL || level.t oInt() >= Priority.I NFO_INT) | |
62 | { | |
63 | _log .info(mess age); | |
64 | } | |
65 | else if (level == Level.ALL || level.t oInt() >= Priority.D EBUG_INT) | |
66 | { | |
67 | _log .debug(mes sage); | |
68 | } | |
69 | else if (level == Level.ALL || level.t oInt() >= Level.TRAC E_INT) | |
70 | { | |
71 | _log .trace(mes sage); | |
72 | } | |
73 | } | |
74 | ca tch (Excep tion ex) | |
75 | { | |
76 | // Syste m.out.prin tln(new Da te().toStr ing() + ": " + ex.ge tMessage() + " - " + ex.getSta ckTrace()) ; | |
77 | ex.print StackTrace (); | |
78 | throw ex ; | |
79 | } | |
80 | } | |
81 | ||
82 | /** | |
83 | * | |
84 | * Tak e an excep tion and c reates a t ext with m essage plu s the stac k trace | |
85 | * inf ormation | |
86 | * | |
87 | * @pa ram level | |
88 | * @pa ram except ion | |
89 | */ | |
90 | public static vo id Log(Lev el level, Exception exception) | |
91 | { | |
92 | tr y | |
93 | { | |
94 | StringBu ilder logM essage = n ew StringB uilder(); | |
95 | ||
96 | logMessa ge.append( "Message: " + except ion.getMes sage()); | |
97 | logMessa ge.append( System.lin eSeparator ()); | |
98 | ||
99 | for (Sta ckTraceEle ment trace : excepti on.getStac kTrace()) | |
100 | { | |
101 | logM essage.app end("Stack Trace: " + trace.to String()); | |
102 | logM essage.app end(System .lineSepar ator()); | |
103 | } | |
104 | ||
105 | Log(leve l, logMess age.toStri ng()); | |
106 | ||
107 | if(_isDe bug) | |
108 | { | |
109 | exce ption.prin tStackTrac e(); | |
110 | } | |
111 | } | |
112 | ca tch( Excep tion ex) | |
113 | { | |
114 | ex.print StackTrace (); | |
115 | } | |
116 | } | |
117 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.