Skip to content

Commit b416014

Browse files
working between
1 parent d0e71b6 commit b416014

File tree

1 file changed

+17
-28
lines changed

1 file changed

+17
-28
lines changed

core/src/main/java/oracle/weblogic/deploy/logging/SummaryHandler.java

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class SummaryHandler extends MemoryHandler implements WLSDeployLogEndHand
4040
private static final String LINE_SEPARATION = System.lineSeparator();
4141

4242
private PlatformLogger LOGGER = WLSDeployLogFactory.getLogger("wlsdeploy.exit");
43-
private boolean recap = false;
43+
private boolean online = false;
4444
private String toolName;
4545
private int bufferSize;
4646

@@ -55,7 +55,7 @@ public SummaryHandler() {
5555
super();
5656
configure();
5757
target = getConsoleHandler();
58-
target.setFormatter(new SummaryFormatter());
58+
target.setFormatter(new TotalFormatter());
5959
LOGGER.setLevel(Level.INFO);
6060
addLevelHandler(Level.INFO);
6161
addLevelHandler(Level.WARNING);
@@ -89,6 +89,8 @@ public synchronized void push() {
8989
closed = true;
9090
setPushLevel(getLevel());
9191
StringBuffer buffer = new StringBuffer();
92+
System.out.println(LINE_SEPARATION);
93+
target.publish(getLogRecord("WLSDPLY-21003", toolName));
9294
java.util.Formatter fmt = new java.util.Formatter(buffer);
9395
for (LevelHandler handler : handlers) {
9496
int count = handler.pushSection();
@@ -112,24 +114,6 @@ public void close() throws SecurityException {
112114
super.close();
113115
}
114116

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-
133117
/**
134118
* This method is called by the tool to complete the SummaryHandler, and display the recap and total information
135119
* 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() {
139123
*/
140124
@Override
141125
public void logEnd(String toolName, boolean onlineMode) {
142-
setRecap(onlineMode);
143126
this.toolName = toolName;
144127
push();
145128
}
@@ -160,15 +143,25 @@ public static Properties getHandlerProperties() {
160143

161144
private void addLevelHandler(Level level) {
162145
LevelHandler handler;
146+
Handler levelTarget = getConsoleHandler();
147+
levelTarget.setFormatter(new SummaryFormatter());
163148
if (getLevel().intValue() <= level.intValue()) {
164-
handler = new LevelHandler(target, bufferSize, level);
149+
handler = new LevelHandler(levelTarget, bufferSize, level);
165150
} else {
166-
handler = new NoActionHandler(target, bufferSize, level);
151+
handler = new NoActionHandler(levelTarget, bufferSize, level);
167152
}
168153
handler.setLevel(level);
169154
handler.setFilter(getFilter());
170155
handlers.add(handler);
171156
}
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+
172165
private class SummaryFormatter extends Formatter {
173166

174167
private final String MSG_FORMAT = " %1$5d. %2$s: %3$s" + System.lineSeparator();
@@ -219,11 +212,7 @@ public synchronized void publish(LogRecord record) {
219212
}
220213

221214
public synchronized int pushSection() {
222-
if (isRecap()) {
223-
logStart();
224-
super.push();
225-
logEnd();
226-
}
215+
super.push();
227216
int result = totalRecords;
228217
totalRecords = 0;
229218
return result;

0 commit comments

Comments
 (0)