Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to specify log level in Bolt >= 1.4.0 #405

Closed
4 of 9 tasks
zachsirotto opened this issue Feb 14, 2020 · 5 comments · Fixed by #406
Closed
4 of 9 tasks

Unable to specify log level in Bolt >= 1.4.0 #405

zachsirotto opened this issue Feb 14, 2020 · 5 comments · Fixed by #406
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:minor

Comments

@zachsirotto
Copy link

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 [ ])

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

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

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • 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

@zachsirotto zachsirotto changed the title Unable to specify log level in Bolt Unable to specify log level in Bolt >= 1.4.0 Feb 14, 2020
@seratch seratch added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:minor labels Feb 15, 2020
@seratch
Copy link
Member

seratch commented Feb 15, 2020

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.

@zachsirotto
Copy link
Author

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!

@zachsirotto
Copy link
Author

zachsirotto commented Feb 16, 2020

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 #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!

@seratch
Copy link
Member

seratch commented Feb 16, 2020

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

seratch added a commit to seratch/bolt-js that referenced this issue Feb 18, 2020
seratch added a commit that referenced this issue Feb 19, 2020
Fix #405 by providing a better way to configure logger
seratch added a commit that referenced this issue Feb 19, 2020
[v2] Fix #405 by providing a better way to configure logger
@seratch
Copy link
Member

seratch commented Feb 19, 2020

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:minor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants