{"id":19990027,"url":"https://github.com/marsprince/nest-log4js","last_synced_at":"2025-07-27T23:32:34.129Z","repository":{"id":57310040,"uuid":"148430845","full_name":"marsprince/nest-log4js","owner":"marsprince","description":"a log4js module for Nest.","archived":false,"fork":false,"pushed_at":"2020-07-04T07:45:21.000Z","size":144,"stargazers_count":12,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-27T05:21:42.970Z","etag":null,"topics":["nestjs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marsprince.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-09-12T06:14:32.000Z","updated_at":"2022-08-03T07:35:56.000Z","dependencies_parsed_at":"2022-09-08T05:41:07.075Z","dependency_job_id":null,"html_url":"https://github.com/marsprince/nest-log4js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marsprince/nest-log4js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marsprince%2Fnest-log4js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marsprince%2Fnest-log4js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marsprince%2Fnest-log4js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marsprince%2Fnest-log4js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marsprince","download_url":"https://codeload.github.com/marsprince/nest-log4js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marsprince%2Fnest-log4js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267345540,"owners_count":24072542,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["nestjs","typescript"],"created_at":"2024-11-13T04:50:54.544Z","updated_at":"2025-07-27T23:32:33.875Z","avatar_url":"https://github.com/marsprince.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"## Description\nThis's a [log4js](https://github.com/log4js-node/log4js-node) module for [Nest](https://github.com/nestjs/nest).\n\n## Installation\n\n```bash\n$ npm install nest-log4js\n```\n\n## Quick Start\n\nLogger is a global module in general, so I just list global usage.\n\nIf you want to Manual logger, see provider bottom, inject and log.\n\n### Include Module\n\n\u003eapp.module.ts\n\n```ts\nimport { Log4jsModule } from 'nest-log4js';\n@Module({\n    imports: [\n        ...\n         Log4jsModule.forRoot(config),\n    ]\n})\nexport class AppModule {\n}\n\n```\n[Optional Settings](https://log4js-node.github.io/log4js-node/api.html)\nis inspired by official settings\n\nIf you use Interceptor, you should ensure 'response' and 'request' in your config categories.\n\nIf you use Filter, you should ensure 'error' in your config categories.\n\n### Using Interceptor\nInterceptor is provided for logging request and response, you can also implement your Interceptor by extend.\n\n\u003eapp.module.ts\n\n```ts\nimport { Log4jsInterceptor } from 'nest-log4js';\n@Module({\n     providers: [{\n        provide: 'LOG4JS_INTERCEPTOR',\n        useClass: Log4jsInterceptor,\n      }],\n})\nexport class AppModule {\n}\n```\n\n### System logger\n\n\u003emain.ts\n\n```ts\nimport { Log4jsService } from 'nest-log4js';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule, {\n    logger: false,\n  });\n  app.useLogger(app.get(Log4jsService));\n  await app.listen(3000);\n}\n```\n\n### Using filter\nFilter is provided for logging error, you can also implement your Filter by extend.\n\n\u003e main.ts\n\n```ts\nimport { Log4jsFilter } from 'nest-log4js';\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule, {\n    logger: false,\n  });\n  app.useGlobalFilters(app.get(Log4jsFilter));\n  await app.listen(3000);\n}\n```\n\n### Provider\n\nLOG4JS_CONFIG: your config\n\nLOG4JS_PROVIDER: configure(config): Logger\n\nLOG4JS_REQUEST_LOGGER\n\nLOG4JS_RESPONSE_LOGGER\n\nLOG4JS_ERROR_LOGGER \n\n### Tips\n\nIf you use pm2, please look [clustering](https://log4js-node.github.io/log4js-node/clustering.html)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarsprince%2Fnest-log4js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarsprince%2Fnest-log4js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarsprince%2Fnest-log4js/lists"}