You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*`application` - `string` (optional, defaults to empty string) - used to identify your application's logs
14
-
*`timeout` - `integer` (optional, defaults to 5000ms) - the timeout for the HTTP request.
15
-
*`configContext` - function (optional) returning a global context object accessible to all appenders. Properties from configContext added as `p_` values in the logFaces event.
16
-
*`hostname` - `string` (optional) - used to add the hostname `h` property to the logFaces event.
11
+
-`type` - `@log4js-node/logfaces-http`
12
+
-`url` - `string` - logFaces receiver servlet URL
13
+
-`application` - `string` (optional, defaults to empty string) - used to identify your application's logs
14
+
-`timeout` - `integer` (optional, defaults to 5000ms) - the timeout for the HTTP request.
15
+
-`configContext` - function (optional) returning a global context object accessible to all appenders. Properties from configContext added as `p_` values in the logFaces event.
16
+
-`hostname` - `string` (optional) - used to add the hostname `h` property to the logFaces event.
17
17
18
18
This appender will also pick up Logger context values from the events, and add them as `p_` values in the logFaces event. See the example below for more details. Note that Logger context may override the same properties defined in `configContext`.
19
19
20
20
# Example (default config)
21
21
22
22
```javascript
23
-
24
23
// global context variables can be specified like this
25
24
// these variables will propagate to logFaces server with all requests
// instances of the logger is obtained from framework like this
41
45
constlogger=log4js.getLogger();
42
46
43
47
// local context variables can propagate to logFaces along with global context
44
-
logger.addContext('requestId', '123');
45
-
logger.info('some interesting log message');
48
+
logger.addContext("requestId", "123");
49
+
logger.info("some interesting log message");
46
50
47
51
// global context variables can be modified anywhere in the app
48
52
MDC.sessionID=222;
49
-
logger.error('something has gone wrong', newError('exception message'));
53
+
logger.error("something has gone wrong", newError("exception message"));
50
54
```
55
+
51
56
This example will result in two log events being sent to `lfs-server`. Both events will have a `requestId` property with a value of `123`. First event will have `sessionID` of `111` and second `sessionID` of `222`. Also since `enableCallStack` is set, both events will include location details such as file name, function name and line number. Second event will have a stack trace of a trown error.
0 commit comments