Remove excessively verbose logs (#166525)

Revert #162665
This commit is contained in:
Gerard Soldevila 2023-09-14 23:41:10 +02:00 committed by GitHub
parent c95acfc260
commit 33108a1638
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 17 deletions

View file

@ -200,7 +200,7 @@ export class Router<Context extends RequestHandlerContextBase = RequestHandlerCo
try {
kibanaRequest = CoreKibanaRequest.from(request, routeSchemas);
} catch (error) {
this.log.error(`400 Bad Request - ${request.path}`, {
this.log.error(`400 Bad Request`, {
http: { response: { status_code: 400 } },
});
@ -216,7 +216,7 @@ export class Router<Context extends RequestHandlerContextBase = RequestHandlerCo
// forward 401 errors from ES client
if (isElasticsearchUnauthorizedError(error)) {
this.log.error(`401 Unauthorized - ${request.path}`, {
this.log.error(`401 Unauthorized`, {
http: { response: { status_code: 401 } },
});
return hapiResponseAdapter.handle(
@ -225,7 +225,7 @@ export class Router<Context extends RequestHandlerContextBase = RequestHandlerCo
}
// return a generic 500 to avoid error info / stack trace surfacing
this.log.error(`500 Server Error - ${request.path}`, {
this.log.error(`500 Server Error`, {
http: { response: { status_code: 500 } },
});
return hapiResponseAdapter.toInternalError();

View file

@ -578,7 +578,7 @@ describe('Handler', () => {
);
const [message] = loggingSystemMock.collect(logger).error[0];
expect(message).toEqual('500 Server Error - /');
expect(message).toEqual('500 Server Error');
});
it('captures the error if handler throws', async () => {
@ -614,7 +614,7 @@ describe('Handler', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
@ -643,7 +643,7 @@ describe('Handler', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
@ -687,7 +687,7 @@ describe('Handler', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"400 Bad Request - /",
"400 Bad Request",
Object {
"http": Object {
"response": Object {
@ -1171,7 +1171,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
@ -1584,7 +1584,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
@ -1660,7 +1660,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
@ -1807,7 +1807,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
@ -1840,7 +1840,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
@ -1872,7 +1872,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {
@ -1904,7 +1904,7 @@ describe('Response factory', () => {
expect(loggingSystemMock.collect(logger).error).toMatchInlineSnapshot(`
Array [
Array [
"500 Server Error - /",
"500 Server Error",
Object {
"http": Object {
"response": Object {

View file

@ -34,9 +34,7 @@ export class DefaultSLOInstaller implements SLOInstaller {
await this.sloResourceInstaller.ensureCommonResourcesInstalled();
await this.sloSummaryInstaller.installAndStart();
} catch (error) {
this.logger.error('Failed to install SLO common resources and summary transforms', {
error,
});
this.logger.error('Failed to install SLO common resources and summary transforms');
} finally {
this.isInstalling = false;
clearTimeout(installTimeout);