Open sshhawwnn opened 1 year ago
Can I have more information?
Also, how about the default.txt
?
Is it the same as the info.txt
screenshot?
Log4js: 6.9.1 Node.js: 20.6 Running on Docker.
default.txt
permissions are same as info.txt
Tried with both
mode: 384
ormode: 0o644
, none is working.
Hi, based on your code, which uses mode: 384
, it works as intended.
384
-> 0o600
-> -rw-------
, validated by your screenshot.
If you want 0o644
(-rw-r--r--
), you can use either mode: 420
or mode: 0o644
.
Also, if the file is an existing file, it will retain the existing permissions and permissions specified in the log4js
configuration will not take effect. So, please make sure you delete the file for a clean test.
You might also want to check the umask
of the environment, as it will mask the supplied mode configuration.
const log4js = require('log4js');
const BACKUP_VAL = 3;
const MAXSIZE_VAL = 1048576;
const CONFIG = {
appenders: {
out: { type: 'console' },
info: {
type: 'dateFile',
filename: 'logs/info.txt',
alwaysIncludePattern: true,
keepFileExt: true,
numBackups: BACKUP_VAL,
maxLogSize: MAXSIZE_VAL,
mode: 0o600
},
default: {
type: 'dateFile',
filename: 'logs/default.txt',
alwaysIncludePattern: true,
keepFileExt: true,
numBackups: BACKUP_VAL,
maxLogSize: MAXSIZE_VAL,
mode: 0o644
}
},
categories: {
info: { appenders: ['info'], level: 'info' },
default: { appenders: ['out', 'default'], level: 'info' },
}
};
log4js.configure(CONFIG);
const loginfo = log4js.getLogger("info");
const logothers = log4js.getLogger("others");
loginfo.info("test");
logothers.info("test");
info.txt is 0o600 or 384 or -rw-------
default.txt is 0o644 or 420 or -rw-r--r--
@sshhawwnn, any updates?
Tried with both
mode: 384
ormode: 0o644
, none is working.