-
Notifications
You must be signed in to change notification settings - Fork 768
TypeError: log4js.getLogger is not a function #1410
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
Comments
What's your import statement? Did you try this? import * as log4js from "log4js";
log4js.configure({
appenders: { cheese: { type: "file", filename: "cheese.log" } },
categories: { default: { appenders: ["cheese"], level: "error" } },
});
const logger = log4js.getLogger();
logger.level = "debug";
logger.debug("Some debug messages"); (src: https://github.com/log4js-node/log4js-node?tab=readme-ov-file#typescript) |
The whole import * as log4js from "log4js";
export let defaultLogger = log4js.getLogger(); If I do
|
@TheChilliPL @lamweili |
@relandboyle Never fixed it, just never started using this logger, because I don't have the time necessary to debug this issue. If you find a way to fix it, however, please do let know! |
import log4js from "log4js";
const logger = log4js.getLogger();
logger.level = "debug"; Now I was able to do it. |
This is the correct way to import. The documentation really needs to be updated. Just lost a lot of time trying to understand why I was getting the "log4js.[blank] is not a function" errors. |
Trying to use anything in
log4js
causes a TypeError. IDE sees all the methods correctly, but TypeScript itself does not.Importing with
import { getLogger } from "log4js"
doesn't work eitherThe text was updated successfully, but these errors were encountered: