Skip to content

How to configuring preffix or suffix of log? #10

Open
@hemavidal

Description

@hemavidal

There is a way to configure where the extended text will be placed in log message?

This:

log4js_extend(log4js, {
  path: __dirname,
  format: "at @name (@file:@line:@column)"
})
log4js.configure({
	appenders: { index: { type: 'file', filename: logpath, maxLogSize: 20480, backups: 10 }, out: { type: 'stdout' } },
	categories: { default: { appenders: ['index', 'out'], level: 'info' } }
})
const logger = log4js.getLogger('index')
logger.info('my info message')

Results in:

[2017-09-22 13:58:31.517] [INFO] index - my info message at methodName (index.js:24:10)
And i want to modify to this:
[2017-09-22 13:58:31.517] [INFO] index [methodName (index.js:24:10)] - my info message
There is a way to do it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions