We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Here is the test repo: a simple nestjs project. Only need two commands to start:
pnpm install nest start --watch
And then call GET http://localhost:3000/hello to test.
GET http://localhost:3000/hello
In this example, it will output as following, not working in nestjs lib and its initialization:
[Nest] 15968 - 2024/11/16 06:07:36 LOG [NestFactory] Starting Nest application... [Nest] 15968 - 2024/11/16 06:07:36 LOG [InstanceLoader] SharedModule dependencies initialized +6ms [Nest] 15968 - 2024/11/16 06:07:36 LOG [InstanceLoader] AppModule dependencies initialized +0ms [Nest] 15968 - 2024/11/16 06:07:36 LOG [InstanceLoader] Log4jsModule dependencies initialized +2ms 2024-11-16 06:07:36.539 [INFO] log4js.classes.js:38 - AppController {/}: 2024-11-16 06:07:36.541 [INFO] log4js.classes.js:38 - Mapped {/hello, GET} route 2024-11-16 06:07:36.543 [INFO] log4js.classes.js:38 - Nest application successfully started 2024-11-16 06:07:50.318 [INFO] app.controller.ts:14 - xxx Hello World!
The text was updated successfully, but these errors were encountered:
please refer to nestjs use external logger
NestApplicationContextOptions#bufferLogs
import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { Log4jsLogger } from "@nestx-log4js/core"; async function bootstrap() { const app = await NestFactory.create(AppModule, { bufferLogs: true, }); app.useLogger(app.get(Log4jsLogger)); await app.listen(3000); } bootstrap();
Sorry, something went wrong.
please refer to nestjs use external logger NestApplicationContextOptions#bufferLogs import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { Log4jsLogger } from "@nestx-log4js/core"; async function bootstrap() { const app = await NestFactory.create(AppModule, { bufferLogs: true, }); app.useLogger(app.get(Log4jsLogger)); await app.listen(3000); } bootstrap();
thx for ur reply, it can work in initialization now. But the recorded file and line number in lib log is still log4js.classes.js:38, is it normal?
No branches or pull requests
test repo
Here is the test repo: a simple nestjs project.
Only need two commands to start:
And then call
GET http://localhost:3000/hello
to test.actual result
In this example, it will output as following, not working in nestjs lib and its initialization:
The text was updated successfully, but these errors were encountered: