From 946b17a89e17bc63c27ac3fc4ff1f8f499db4ba6 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Wed, 3 May 2017 08:38:42 +1000 Subject: [PATCH] docs(logFaces): added logFaces docs --- docs/logFaces-HTTP.md | 31 +++++++++++++++++++++++++++++++ docs/logFaces-UDP.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 docs/logFaces-HTTP.md create mode 100644 docs/logFaces-UDP.md diff --git a/docs/logFaces-HTTP.md b/docs/logFaces-HTTP.md new file mode 100644 index 0000000..f60b38a --- /dev/null +++ b/docs/logFaces-HTTP.md @@ -0,0 +1,31 @@ +# 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`. diff --git a/docs/logFaces-UDP.md b/docs/logFaces-UDP.md new file mode 100644 index 0000000..29422d0 --- /dev/null +++ b/docs/logFaces-UDP.md @@ -0,0 +1,31 @@ +# logFaces Appender (UDP) + +The logFaces appenders send JSON formatted log events to [logFaces](http://www.moonlit-software.com) receivers. This appender uses UDP to send the events (there is another logFaces appender that uses [HTTP](logFaces-HTTP.md)). It uses the node.js core UDP support, so you do not need to include any other dependencies. + +## Configuration + +* `type` - `logFaces-UDP` +* `remoteHost` - `string` (optional, defaults to '127.0.0.1')- hostname or IP address of the logFaces receiver +* `port` - `integer` (optional, defaults to 55201) - port the logFaces receiver is listening on +* `application` - `string` (optional, defaults to empty string) - used to identify your application's logs + +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-UDP' } + }, + 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 via UDP to `127.0.0.1:55201`. Both events will have a `p_requestId` property with a value of `123`.