mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
Merge pull request #747 from log4js-node/deprecate-logfaces-http
deprecated logFaces-HTTP appender
This commit is contained in:
commit
111fcedca1
@ -24,7 +24,6 @@ The following appenders are included with log4js. Some require extra dependencie
|
||||
* [dateFile](dateFile.md)
|
||||
* [file](file.md)
|
||||
* [fileSync](fileSync.md)
|
||||
* [logFaces-HTTP](logFaces-HTTP.md)
|
||||
* [logFaces-UDP](logFaces-UDP.md)
|
||||
* [logLevelFilter](logLevelFilter.md)
|
||||
* [multiFile](multiFile.md)
|
||||
@ -39,6 +38,7 @@ The following appenders are supported by log4js, but will issue deprecation warn
|
||||
|
||||
* [gelf](https://github.com/log4js-node/gelf)
|
||||
* [hipchat](https://github.com/log4js-node/hipchat)
|
||||
* [logFaces-HTTP](https://github.com/log4js-node/logFaces-HTTP)
|
||||
* [loggly](https://github.com/log4js-node/loggly)
|
||||
* [logstashHTTP](https://github.com/log4js-node/logstashHTTP)
|
||||
* [logstashUDP](https://github.com/log4js-node/logstashUDP)
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
# logFaces Appender (HTTP)
|
||||
|
||||
The logFaces appenders send JSON formatted log events to [logFaces](http://www.moonlit-software.com) receivers. This appender uses HTTP to send the events (there is another logFaces appender that uses [UDP](logFaces-UDP.md)). You will need to include [axios](https://www.npmjs.com/package/axios) in your dependencies to use this appender.
|
||||
|
||||
## Configuration
|
||||
|
||||
* `type` - `logFaces-HTTP`
|
||||
* `url` - `string` - logFaces receiver servlet URL
|
||||
* `application` - `string` (optional, defaults to empty string) - used to identify your application's logs
|
||||
* `timeout` - `integer` (optional, defaults to 5000ms) - the timeout for the HTTP request.
|
||||
|
||||
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.
|
||||
|
||||
# Example (default config)
|
||||
|
||||
```javascript
|
||||
log4js.configure({
|
||||
appenders: {
|
||||
logfaces: { type: 'logFaces-HTTP', url: 'http://lfs-server/logs' }
|
||||
},
|
||||
categories: {
|
||||
default: { appenders: [ 'logfaces' ], level: 'info' }
|
||||
}
|
||||
});
|
||||
|
||||
const logger = log4js.getLogger();
|
||||
logger.addContext('requestId', '123');
|
||||
logger.info('some interesting log message');
|
||||
logger.error('something has gone wrong');
|
||||
```
|
||||
This example will result in two log events being sent to `lfs-server`. Both events will have a `p_requestId` property with a value of `123`.
|
||||
@ -1,4 +1,7 @@
|
||||
/**
|
||||
* This appender is deprecated. All bugfixes and improvements should be made in
|
||||
* https://github.com/log4js-node/logFaces-HTTP
|
||||
*
|
||||
* logFaces appender sends JSON formatted log events to logFaces receivers.
|
||||
* There are two types of receivers supported - raw UDP sockets (for server side apps),
|
||||
* and HTTP (for client side apps). Depending on the usage, this appender
|
||||
@ -33,7 +36,7 @@ function logFacesAppender(config) {
|
||||
withCredentials: true
|
||||
});
|
||||
|
||||
return function log(event) {
|
||||
const appender = function log(event) {
|
||||
// convert to logFaces compact json format
|
||||
const lfsEvent = {
|
||||
a: config.application || '', // application name
|
||||
@ -58,6 +61,9 @@ function logFacesAppender(config) {
|
||||
console.error(`log4js.logFaces-HTTP Appender error: ${error.message}`);
|
||||
});
|
||||
};
|
||||
|
||||
appender.deprecated = '@log4js-node/logfaces-http';
|
||||
return appender;
|
||||
}
|
||||
|
||||
function configure(config) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user