{"id":18278194,"url":"https://github.com/log4js-node/logfaces-http","last_synced_at":"2025-04-05T04:31:04.615Z","repository":{"id":37519672,"uuid":"139499087","full_name":"log4js-node/logFaces-HTTP","owner":"log4js-node","description":"LogFaces HTTP appender for log4js-node","archived":false,"fork":false,"pushed_at":"2024-01-10T01:03:49.000Z","size":584,"stargazers_count":6,"open_issues_count":5,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-20T22:18:36.517Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/log4js-node.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-02T21:58:01.000Z","updated_at":"2024-07-12T04:56:45.000Z","dependencies_parsed_at":"2023-02-08T09:46:11.940Z","dependency_job_id":null,"html_url":"https://github.com/log4js-node/logFaces-HTTP","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/log4js-node%2FlogFaces-HTTP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/log4js-node%2FlogFaces-HTTP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/log4js-node%2FlogFaces-HTTP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/log4js-node%2FlogFaces-HTTP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/log4js-node","download_url":"https://codeload.github.com/log4js-node/logFaces-HTTP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289382,"owners_count":20914463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T12:23:25.760Z","updated_at":"2025-04-05T04:30:59.550Z","avatar_url":"https://github.com/log4js-node.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logFaces Appender (HTTP) for log4js-node\n\nThe 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](https://github.com/log4js-node/logFaces-UDP)).\n\n```bash\nnpm install log4js @log4js-node/logfaces-http\n```\n\n## Configuration\n\n- `type` - `@log4js-node/logfaces-http`\n- `url` - `string` - logFaces receiver servlet URL\n- `application` - `string` (optional, defaults to empty string) - used to identify your application's logs\n- `timeout` - `integer` (optional, defaults to 5000ms) - the timeout for the HTTP request.\n- `configContext` - function (optional) returning a global context object accessible to all appenders. Properties from configContext added as `p_` values in the logFaces event.\n- `hostname` - `string` (optional) - used to add the hostname `h` property to the logFaces event.\n- `agent` - `http.Agent | https.Agent` (optional) - used to configure the requests being sent out if needed.\n- `eventLayout` - `(LoggingEvent, LogFacesEvent) =\u003e LogFacesEvent` (optional) - allows more control and ability to modify and set the properties of the LogFacesEvent that will get sent to the server. Note: returning `null` or `undefined` will cause the event to be ignored and not logged. If `LogFacesEvent.m` is nullish, the default format for the message will be applied.\n\nThis 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`.\n\n# Example (default config)\n\n```javascript\n// global context variables can be specified like this\n// these variables will propagate to logFaces server with all requests\nconst MDC = {\n  sessionID: 111,\n};\n\n// log4js framework configuration\nlog4js.configure({\n  appenders: {\n    logfaces: {\n      type: \"@log4js-node/logfaces-http\",\n      url: \"http://lfs-server/logs\",\n      application: \"TesterApp\",\n      configContext: () =\u003e MDC,\n    },\n  },\n  categories: {\n    default: { appenders: [\"logfaces\"], level: \"info\", enableCallStack: true },\n  },\n});\n\n// instances of the logger is obtained from framework like this\nconst logger = log4js.getLogger();\n\n// local context variables can propagate to logFaces along with global context\nlogger.addContext(\"requestId\", \"123\");\nlogger.info(\"some interesting log message\");\n\n// global context variables can be modified anywhere in the app\nMDC.sessionID = 222;\nlogger.error(\"something has gone wrong\", new Error(\"exception message\"));\n```\n\nThis 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flog4js-node%2Flogfaces-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flog4js-node%2Flogfaces-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flog4js-node%2Flogfaces-http/lists"}