Bolt-js: Unable to specify log level in Bolt >= 1.4.0

Created on 14 Feb 2020  路  5Comments  路  Source: slackapi/bolt-js

Description

I am unable to specify the log level after upgrading from 1.2.0 to 1.4.0 and up.

What type of issue is this? (place an x in one of the [ ])

  • [x] bug
  • [ ] enhancement (feature request)
  • [ ] question
  • [ ] documentation related
  • [ ] testing related
  • [ ] discussion

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

package version: >= 1.4.0

node version: v12.12.0

OS version(s): macOS Catalina 10.15.1

Steps to reproduce:

  1. Define logLevel when creating a Bolt app in >= 1.4.0

Expected result:

What you expected to happen

I expect to see the logger initialized for WebClient:0 after the Bolt app is initialized.

i.e.

[DEBUG]  WebClient:0 initialized

Actual result:

Upon initialization of the bolt app, I get:

[DEBUG]   The logLevel given to WebClient was ignored as you also gave logger
[DEBUG]   initialized

It seems that every time the logger attempts to log, i get another [DEBUG] initialized message.

Another symptom i noticed is that all the logs messages aren't prefixed with a logger name i.e. WebClient:0 but rather they're prefixed with a space.

Attachments:

logs are posted above

bug minor

Most helpful comment

@zachsirotto No worries. I'm aware of the issue. The PR addresses the issue as well.

All 5 comments

Thanks for taking the time to report this. You're right. The behavior needs to be improved. I just finished the implementation to address this issue. I will make a pull request within a few hours. It would be appreciated if you could take a look at the fix and give feedback on it if you have some.

Thanks for taking the time to report this. You're right. The behavior needs to be improved. I just finished the implementation to address this issue. I will make a pull request within a few hours. It would be appreciated if you could take a look at the fix and give feedback on it if you have some.

Thank you so much for getting back to me and deciding to take action so quickly!

I think it's also worth noting that i'm unable to specify a log level by creating my own logger as you did in https://github.com/slackapi/bolt/pull/406 to show how to customize the logger name. When I specify a log level of DEBUG I end up getting no logging information.

i.e.

const { LogLevel, ConsoleLogger } = require("@slack/logger");
const logger = new ConsoleLogger();
logger.setName('my-bolt-app');
logger.setLevel(LogLevel.DEBUG);

const { App } = require("@slack/bolt");
const app = new App({
  logger: logger,
  token: process.env.SLACK_BOT_TOKEN,
  signingSecret: process.env.SLACK_SIGNING_SECRET
});

results in

鈿★笍 Bolt app is running!

@zachsirotto No worries. I'm aware of the issue. The PR addresses the issue as well.

Thanks for flagging this. The fix has been merged. This issue will be fixed in bolt version 1.7.x / 2.x. They'll be released soon (if everything goes well, both of them will be shipped within a month).

Was this page helpful?
0 / 5 - 0 ratings