Skip to content

Commit b47ad7f

Browse files
vgavinashGitHub Enterprise
authored andcommitted
Make 'qmgr' logs as default (#401)
* Required updates * Update docker_api_test.go
1 parent 167ec03 commit b47ad7f

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

cmd/runmqserver/logging.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ func getMQLogConsoleSource() string {
371371
func isLogConsoleSourceValid() bool {
372372
mqLogSource := getMQLogConsoleSource()
373373
retValue := false
374-
//If nothing is set, we will mirror all, so valid
374+
//If nothing is set, we will mirror qmgr, so valid
375375
if mqLogSource == "" {
376376
return true
377377
}
@@ -396,9 +396,14 @@ func isLogConsoleSourceValid() bool {
396396
func checkLogSourceForMirroring(source string) bool {
397397
logsrcs := getMQLogConsoleSource()
398398

399-
//Nothing set, this is when we mirror all
399+
//Nothing set, this is when we mirror qmgr
400400
if logsrcs == "" {
401-
return true
401+
if source == "qmgr" {
402+
return true
403+
} else {
404+
return false
405+
}
406+
402407
}
403408

404409
//Split the csv environment value so that we get an accurate comparison instead of a contains() check

cmd/runmqserver/logging_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var mqLogSourcesTests = []struct {
6767
{2, "qmgr", true, true, false},
6868
{3, "web,qmgr", true, true, true},
6969
{4, "web", true, false, true},
70-
{5, " ", true, true, true},
70+
{5, " ", true, true, false},
7171
{6, "QMGR,WEB", true, true, true},
7272
{7, "qmgr, ", true, true, false},
7373
{8, "qmgr , web", true, true, true},
@@ -77,7 +77,7 @@ var mqLogSourcesTests = []struct {
7777
{12, "fake,dummy,web", false, false, true},
7878
{13, "true", false, false, false},
7979
{14, "false", false, false, false},
80-
{15, "", true, true, true},
80+
{15, "", true, true, false},
8181
}
8282

8383
func TestLoggingConsoleSourceInputs(t *testing.T) {

test/docker/docker_api_test.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,11 +1520,6 @@ func TestLoggingConsoleSource(t *testing.T) {
15201520
t.Errorf("%v", errJson)
15211521
}
15221522

1523-
jsonLogs, errJson = waitForMessageInLog(t, cli, id, "CWWKF0011I")
1524-
if errJson != nil {
1525-
t.Errorf("%v", errJson)
1526-
}
1527-
15281523
isMessageFound := scanForExcludedEntries(jsonLogs)
15291524

15301525
if isMessageFound == true {
@@ -1669,7 +1664,7 @@ func TestLoggingWithQmgrAndExcludeId(t *testing.T) {
16691664
t.Fatalf("Expected all log lines to be valid JSON. But got error %v ", err)
16701665
}
16711666

1672-
if strings.Contains(jsonLogs, "AMQ7230I") || strings.Contains(jsonLogs, "CWWKF0011I") {
1667+
if strings.Contains(jsonLogs, "AMQ7230I") || strings.Contains(jsonLogs, "CWWKF0011I") {
16731668
t.Errorf("Expected to exclude messageId by default; but messageId \"%v\" is present", jsonLogs)
16741669
}
16751670

0 commit comments

Comments
 (0)