Skip to content

Commit

Permalink
Fix error thrown when Kibana is sent a SIGHUP to reload logging config (
Browse files Browse the repository at this point in the history
#89218)

* Fix error thrown when Kibana is sent a SIGHUP to reload logging config

* Adding a simple unit test to catch a future regression

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
kobelb and kibanamachine committed Jan 29, 2021
1 parent 7609fb9 commit a6fe0a2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
35 changes: 35 additions & 0 deletions packages/kbn-legacy-logging/src/setup_logging.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* and the Server Side Public License, v 1; you may not use this file except in
* compliance with, at your election, the Elastic License or the Server Side
* Public License, v 1.
*/

import { Server } from '@hapi/hapi';
import { reconfigureLogging, setupLogging } from './setup_logging';
import { LegacyLoggingConfig } from './schema';

describe('reconfigureLogging', () => {
test(`doesn't throw an error`, () => {
const server = new Server();
const config: LegacyLoggingConfig = {
silent: false,
quiet: false,
verbose: true,
events: {},
dest: '/tmp/foo',
filter: {},
json: true,
rotate: {
enabled: false,
everyBytes: 0,
keepFiles: 0,
pollingInterval: 0,
usePolling: false,
},
};
setupLogging(server, config, 10);
reconfigureLogging(server, { ...config, dest: '/tmp/bar' }, 0);
});
});
2 changes: 1 addition & 1 deletion packages/kbn-legacy-logging/src/setup_logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ export function reconfigureLogging(
opsInterval: number
) {
const loggingOptions = getLoggingConfiguration(config, opsInterval);
(server.plugins as any)['@elastic/good'].reconfigure(loggingOptions);
(server.plugins as any).good.reconfigure(loggingOptions);
}

0 comments on commit a6fe0a2

Please sign in to comment.