-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25150 from vespa-engine/arnej/add-tuning-of-logging
Arnej/add tuning of logging
- Loading branch information
Showing
19 changed files
with
321 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
config-model/src/main/java/com/yahoo/vespa/model/LogctlSpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
package com.yahoo.vespa.model; | ||
|
||
public class LogctlSpec { | ||
public final String componentSpec; | ||
public final String levelsModSpec; | ||
public LogctlSpec(String componentSpec, String levelsModSpec) { | ||
this.componentSpec = componentSpec; | ||
this.levelsModSpec = levelsModSpec; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
|
||
#include "logctl.h" | ||
|
||
#include <sys/types.h> | ||
#include <sys/wait.h> | ||
#include <unistd.h> | ||
#include <stdio.h> | ||
|
||
#include <vespa/log/log.h> | ||
LOG_SETUP(".sentinel.logctl"); | ||
|
||
namespace config::sentinel { | ||
|
||
void justRunLogctl(const char *cspec, const char *lspec) | ||
{ | ||
const char *progName = "vespa-logctl"; | ||
pid_t pid = fork(); | ||
if (pid == 0) { | ||
LOG(debug, "running '%s' '%s' '%s'", progName, cspec, lspec); | ||
int rv = execlp(progName, progName, "-c", cspec, lspec, nullptr); | ||
if (rv != 0) { | ||
LOG(warning, "execlp of '%s' failed: %s", progName, strerror(errno)); | ||
} | ||
} else if (pid > 0) { | ||
int wstatus = 0; | ||
pid_t got = waitpid(pid, &wstatus, 0); | ||
if (got == pid) { | ||
if (WIFEXITED(wstatus)) { | ||
int exitCode = WEXITSTATUS(wstatus); | ||
if (exitCode != 0) { | ||
LOG(warning, "running '%s' failed (exit code %d)", progName, exitCode); | ||
} | ||
} else if (WIFSIGNALED(wstatus)) { | ||
int termSig = WTERMSIG(wstatus); | ||
LOG(warning, "running '%s' failed (got signal %d)", progName, termSig); | ||
} else { | ||
LOG(warning, "'%s' failure (wait status was %d)", progName, wstatus); | ||
} | ||
} else { | ||
LOG(error, "waitpid() failed: %s", strerror(errno)); | ||
} | ||
} else { | ||
LOG(error, "fork() failed: %s", strerror(errno)); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
#pragma once | ||
|
||
namespace config::sentinel { | ||
|
||
void justRunLogctl(const char *cspec, const char *lspec); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.