From 5679eed0220b13f175da2245f0bfd409ce0c51d2 Mon Sep 17 00:00:00 2001 From: Leoni Murilo de Lima Date: Tue, 28 Jan 2020 15:34:44 -0300 Subject: [PATCH 1/2] Update Loading mechanism instruction #1 Update Loading mechanism instruction (number 1 in priority) to match the current behaviour of the library. --- docs/writing-appenders.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/writing-appenders.md b/docs/writing-appenders.md index e09ea51..94c2b9c 100644 --- a/docs/writing-appenders.md +++ b/docs/writing-appenders.md @@ -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. The core appenders: `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)` From 25a47388a327b6123e954dfa1e5a5063c60dada3 Mon Sep 17 00:00:00 2001 From: Lam Wei Li Date: Tue, 22 Mar 2022 11:00:42 +0800 Subject: [PATCH 2/2] chore(docs): updated writing-appenders.md --- docs/writing-appenders.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/writing-appenders.md b/docs/writing-appenders.md index 94c2b9c..7f81b2a 100644 --- a/docs/writing-appenders.md +++ b/docs/writing-appenders.md @@ -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('./' + 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)`