[BUG] System logs skipped on startup
See original GitHub issueHi,
I am using pino with configuration as illustrated below:
// app.module.ts
import { Module } from '@nestjs/common';
import { LoggerModule } from 'nestjs-pino';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import * as pino from 'pino';
const logger = pino({
level: process.env.NODE_ENV !== 'prod' ? 'debug' : 'info',
},pino.destination({
minLength: 4096,
sync: false,
}));
setInterval(function() {
logger.flush();
}, 5000).unref();
@Module({
imports: [
LoggerModule.forRoot({
pinoHttp: {
logger,
autoLogging: true,
serializers: {
err: pino.stdSerializers.err,
req: r => {
return {
id: r.id,
method: r.method,
url: r.url,
};
},
res: pino.stdSerializers.res,
}
},
}),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
and
// main.ts
import { NestFactory } from '@nestjs/core';
import { Logger } from 'nestjs-pino';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule, { logger: false });
app.useLogger(app.get(Logger));
await app.listen(3000);
}
bootstrap();
But the logging output missed the system logging part.
> nest start --watch
[10:11:49 PM] Starting compilation in watch mode...
[10:11:53 PM] Found 0 errors. Watching for file changes.
{"level":30,"time":1604671913986,"pid":28435,"hostname":"2070iMac","context":"RoutesResolver","msg":"AppController {}:"}
{"level":30,"time":1604671913987,"pid":28435,"hostname":"2070iMac","context":"RouterExplorer","msg":"Mapped {, GET} route"}
{"level":30,"time":1604671913989,"pid":28435,"hostname":"2070iMac","context":"NestApplication","msg":"Nest application successfully started"}
It is expected to output as many as system logging output, which has logging form modules like NestFactory and InstanceLoader. Below is the output from the default logger.
[10:33:59 PM] Starting compilation in watch mode...
[10:34:00 PM] Found 0 errors. Watching for file changes.
[Nest] 30928 - 11/06/2020, 10:34:01 PM [NestFactory] Starting Nest application...
[Nest] 30928 - 11/06/2020, 10:34:01 PM [InstanceLoader] LoggerModule dependencies initialized +15ms
[Nest] 30928 - 11/06/2020, 10:34:01 PM [InstanceLoader] LoggerCoreModule dependencies initialized +1ms
[Nest] 30928 - 11/06/2020, 10:34:01 PM [InstanceLoader] AppModule dependencies initialized +0ms
[Nest] 30928 - 11/06/2020, 10:34:01 PM [RoutesResolver] AppController {}: +6ms
[Nest] 30928 - 11/06/2020, 10:34:01 PM [RouterExplorer] Mapped {, GET} route +1ms
[Nest] 30928 - 11/06/2020, 10:34:01 PM [NestApplication] Nest application successfully started +4ms
Here are some sample code to reproduce this issue: https://github.com/wuminqi/example-pino-nestjs
Can you kindly offer a help on this?
Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:17 (9 by maintainers)
Top Results From Across the Web
Windows skipping Sign In on startup - Microsoft Community
Whenever I start up Windows, on the sign in page, the option to enter a password/PIN flashes briefly, and then proceeds to show...
Read more >SOLVED: PC skips BIOS and goes straight to homescreen - iFixit
Go to Control Panel > Power Options > choose what the Power buttons do (left side of page)> Change Settings that are currently...
Read more >BIOS Startup Error Messages and Solutions | Fixing Windows ...
When a system has problems starting, it might display error messages at startup. These messages might come from the system BIOS (ROM BIOS...
Read more >K50265550: ASM Event Log requests are not logging locally.
The most common reason is the use of a security logging profile(s) assigned to virtual servers that are using a 'Request Type' value...
Read more >System is in boot run level ... will skip any checks" in Guardium ...
Problem. Constant "-W- System is in boot run level ... will skip any checks" in Guardium GIM.log and central_logger.log when attempt STAP install...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@StevenLangbroek please add the link to the minimal example repo. I’ll reopen this issue then
Hi, thanks for your kindly reply.
I realize this issue as I misconfigured TypeORM and all the error logs from [TypeOrmModule] is swallowed. I have no idea what exception it is.
I updated the sample repo by adding typeorm and some invalid configurations, link.
Using nestjs-pino, the startup output:
Using default logger, the startup output: