Merge pull request #985 from leonimurilo/patch-1

Update Loading mechanism instruction #1
This commit is contained in:
Lam Wei Li 2022-03-22 11:04:02 +08:00 committed by GitHub
commit 104d271de5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,7 @@ Log4js can load appenders from outside its core set. To add a custom appender, t
When log4js parses your configuration, it loops through the defined appenders. For each one, it will `require` the appender initially using the `type` value prepended with './appenders' as the module identifier - this is to try loading from the core appenders first. If that fails (the module could not be found in the core appenders), then log4js will try to require the module using variations of the `type` value.
Log4js checks the following places (in this order) for appenders based on the type value:
1. The core appenders: `require('./appenders/' + type)`
1. Bundled core appenders (within appenders directory): `require('./' + type)`
2. node_modules: `require(type)`
3. relative to the main file of your application: `require(path.dirname(require.main.filename) + '/' + type)`
4. relative to the process' current working directory: `require(process.cwd() + '/' + type)`