Skip to content

Commit 774df34

Browse files
authored
Merge pull request #730 from oracle/pod_helper_logging-rc1
Log when pods are replaced and use null for LOG_HOME when effective log home is not set
2 parents 7e7b5bc + dafc719 commit 774df34

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

operator/src/main/java/oracle/kubernetes/operator/helpers/JobStepContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected boolean isDomainHomeInImage() {
9999
}
100100

101101
String getEffectiveLogHome() {
102-
if (!getDomain().getLogHomeEnabled()) return "";
102+
if (!getDomain().getLogHomeEnabled()) return null;
103103
String logHome = getLogHome();
104104
if (logHome == null || "".equals(logHome.trim())) {
105105
// logHome not specified, use default value

operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ protected boolean isDomainHomeInImage() {
143143
}
144144

145145
String getEffectiveLogHome() {
146-
if (!getDomain().getLogHomeEnabled()) return "";
146+
if (!getDomain().getLogHomeEnabled()) return null;
147147
String logHome = getLogHome();
148148
if (logHome == null || "".equals(logHome.trim())) {
149149
// logHome not specified, use default value
@@ -434,6 +434,7 @@ public NextAction apply(Packet packet) {
434434
logPodExists();
435435
return doNext(packet);
436436
} else {
437+
LOGGER.info(MessageKeys.CYCLING_POD, currentPod, getPodModel());
437438
return doNext(replaceCurrentPod(getNext()), packet);
438439
}
439440
}

operator/src/main/java/oracle/kubernetes/operator/logging/MessageKeys.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,5 @@ private MessageKeys() {}
145145
public static final String CANNOT_PARSE_INTROSPECTOR_RESULT = "WLSKO-0142";
146146
public static final String CANNOT_PARSE_INTROSPECTOR_FILE = "WLSKO-0143";
147147
public static final String CANNOT_START_DOMAIN_AFTER_MAX_RETRIES = "WLSKO-0144";
148+
public static final String CYCLING_POD = "WLSKO-0145";
148149
}

operator/src/main/resources/Operator.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,5 @@ WLSKO-0140=Job {0} is completed with status: {1}
142142
WLSKO-0141=Failed to parse WebLogic Domain topology due to exception: {0}
143143
WLSKO-0142=Failed to parse results from domain introspector for domain {0} due to exception: {1}
144144
WLSKO-0143=Failed to parse file {0} from domain introspector for domain {1} due to exception: {2}
145-
WLSKO-0144=Unable to start domain with domainUID {0} in namespace {1} after {2} attempts due to exception: {3}
145+
WLSKO-0144=Unable to start domain with domainUID {0} in namespace {1} after {2} attempts due to exception: {3}
146+
WLSKO-0145=Replacing pod {0} with {1}

operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public void whenPodCreated_hasPredefinedEnvVariables() {
326326
hasEnvVar("DOMAIN_UID", UID),
327327
hasEnvVar("NODEMGR_HOME", NODEMGR_HOME),
328328
hasEnvVar("SERVER_OUT_IN_POD_LOG", Boolean.toString(INCLUDE_SERVER_OUT_IN_POD_LOG)),
329-
hasEnvVar("LOG_HOME", ""),
329+
hasEnvVar("LOG_HOME", null),
330330
hasEnvVar("SERVICE_NAME", LegalNames.toServerServiceName(UID, getServerName())),
331331
hasEnvVar("AS_SERVICE_NAME", LegalNames.toServerServiceName(UID, ADMIN_SERVER))));
332332
}
@@ -622,7 +622,7 @@ V1Container createPodSpecContainer() {
622622
.addEnvItem(envItem("NODEMGR_HOME", NODEMGR_HOME))
623623
.addEnvItem(
624624
envItem("SERVER_OUT_IN_POD_LOG", Boolean.toString(INCLUDE_SERVER_OUT_IN_POD_LOG)))
625-
.addEnvItem(envItem("LOG_HOME", ""))
625+
.addEnvItem(envItem("LOG_HOME", null))
626626
.addEnvItem(envItem("SERVICE_NAME", LegalNames.toServerServiceName(UID, getServerName())))
627627
.addEnvItem(envItem("AS_SERVICE_NAME", LegalNames.toServerServiceName(UID, ADMIN_SERVER)))
628628
.livenessProbe(createLivenessProbe())

0 commit comments

Comments
 (0)