I have a log4js configuration like the following (from the docs):
log4js.configure({
appenders: {
everything: { type: "file", filename: "all-the-logs.log" },
},
categories: {
default: { appenders: ["everything"], level: "debug" },
},
});
const logger = log4js.getLogger();
and when I log something, like so:
logger.debug("hello there!")
the word "default" is placed in front of all my logs, like so:
[2022-08-18T21:59:36.225] [DEBUG] default - hello there!
Is there a way to remove this? Thank you!
log4js prints the logger category inside your logs because you are using the basic layout and the category token is present there. You can get rid of it by using a pattern layout that omits the category token
For example this pattern layout definition closly mimics your current configuration
Notice the
%ctoken, it will print the category, so just remove itSo your new
appendersconfiguration will look something like this