Hello, it seems I can't get %f{depth} to work on my system (Windows 10, Node v14.15), here's a sample codeblock:
import log4js from 'log4js';
log4js.configure({
appenders: {
out: {
type: 'console',
layout: {
type: 'pattern',
pattern: '%d %f{1} %m',
},
},
},
categories: {
default: { appenders: ['out'], level: 'info', enableCallStack: true },
},
});
const logger = log4js.getLogger('app');
logger.info('Test log message');
Expected output:
2021-02-22T12:46:30.039 /main.js Test log message
Actual output:
2021-02-22T12:46:30.039 file:///C:/Users/Username/Desktop/Projects/Logtest/src/main.js Test log message
The issue seems to be in layouts.js because path.sep is (correctly) returning \, while filename is file:///C:/Users/Username/Desktop/Projects/Logtest/src/main.js, so the filename is never split.
Is this an OS and/or node misconfiguration on my part?
I managed to correct the issue by modifying layouts.js split separator parameter, I'll submit a fix PR in case this is a general issue.
Hello, it seems I can't get
%f{depth}to work on my system (Windows 10, Node v14.15), here's a sample codeblock:Expected output:
2021-02-22T12:46:30.039 /main.js Test log messageActual output:
2021-02-22T12:46:30.039 file:///C:/Users/Username/Desktop/Projects/Logtest/src/main.js Test log messageThe issue seems to be in
layouts.jsbecausepath.sepis (correctly) returning\, while filename isfile:///C:/Users/Username/Desktop/Projects/Logtest/src/main.js, so the filename is never split.Is this an OS and/or node misconfiguration on my part?
I managed to correct the issue by modifying
layouts.jssplit separator parameter, I'll submit a fix PR in case this is a general issue.