@@ -40,7 +40,7 @@ public class SummaryHandler extends MemoryHandler implements WLSDeployLogEndHand
40
40
private static final String LINE_SEPARATION = System .lineSeparator ();
41
41
42
42
private PlatformLogger LOGGER = WLSDeployLogFactory .getLogger ("wlsdeploy.exit" );
43
- private boolean recap = false ;
43
+ private boolean online = false ;
44
44
private String toolName ;
45
45
private int bufferSize ;
46
46
@@ -55,7 +55,7 @@ public SummaryHandler() {
55
55
super ();
56
56
configure ();
57
57
target = getConsoleHandler ();
58
- target .setFormatter (new SummaryFormatter ());
58
+ target .setFormatter (new TotalFormatter ());
59
59
LOGGER .setLevel (Level .INFO );
60
60
addLevelHandler (Level .INFO );
61
61
addLevelHandler (Level .WARNING );
@@ -89,6 +89,8 @@ public synchronized void push() {
89
89
closed = true ;
90
90
setPushLevel (getLevel ());
91
91
StringBuffer buffer = new StringBuffer ();
92
+ System .out .println (LINE_SEPARATION );
93
+ target .publish (getLogRecord ("WLSDPLY-21003" , toolName ));
92
94
java .util .Formatter fmt = new java .util .Formatter (buffer );
93
95
for (LevelHandler handler : handlers ) {
94
96
int count = handler .pushSection ();
@@ -112,24 +114,6 @@ public void close() throws SecurityException {
112
114
super .close ();
113
115
}
114
116
115
- /**
116
- * Specify if the log records should be displayed to the console before the tool exit.
117
- *
118
- * @param recap if true a recap of the log records will be performed
119
- */
120
- public void setRecap (boolean recap ) {
121
- this .recap = recap ;
122
- }
123
-
124
- /**
125
- * Return whether the log records should be displayed to the console.
126
- *
127
- * @return true if a recap of the log records is specified
128
- */
129
- public boolean isRecap () {
130
- return recap ;
131
- }
132
-
133
117
/**
134
118
* This method is called by the tool to complete the SummaryHandler, and display the recap and total information
135
119
* to the console. The log records are only displayed to the console if the tool was run in online mode.
@@ -139,7 +123,6 @@ public boolean isRecap() {
139
123
*/
140
124
@ Override
141
125
public void logEnd (String toolName , boolean onlineMode ) {
142
- setRecap (onlineMode );
143
126
this .toolName = toolName ;
144
127
push ();
145
128
}
@@ -160,15 +143,25 @@ public static Properties getHandlerProperties() {
160
143
161
144
private void addLevelHandler (Level level ) {
162
145
LevelHandler handler ;
146
+ Handler levelTarget = getConsoleHandler ();
147
+ levelTarget .setFormatter (new SummaryFormatter ());
163
148
if (getLevel ().intValue () <= level .intValue ()) {
164
- handler = new LevelHandler (target , bufferSize , level );
149
+ handler = new LevelHandler (levelTarget , bufferSize , level );
165
150
} else {
166
- handler = new NoActionHandler (target , bufferSize , level );
151
+ handler = new NoActionHandler (levelTarget , bufferSize , level );
167
152
}
168
153
handler .setLevel (level );
169
154
handler .setFilter (getFilter ());
170
155
handlers .add (handler );
171
156
}
157
+
158
+ private class TotalFormatter extends Formatter {
159
+ @ Override
160
+ public synchronized String format (LogRecord record ) {
161
+ return formatMessage (record ) + System .lineSeparator ();
162
+ }
163
+ }
164
+
172
165
private class SummaryFormatter extends Formatter {
173
166
174
167
private final String MSG_FORMAT = " %1$5d. %2$s: %3$s" + System .lineSeparator ();
@@ -219,11 +212,7 @@ public synchronized void publish(LogRecord record) {
219
212
}
220
213
221
214
public synchronized int pushSection () {
222
- if (isRecap ()) {
223
- logStart ();
224
- super .push ();
225
- logEnd ();
226
- }
215
+ super .push ();
227
216
int result = totalRecords ;
228
217
totalRecords = 0 ;
229
218
return result ;
0 commit comments