-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
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
Nestjs example #519
Labels
question
Further information is requested
Comments
@nushrivastava could you provide a reproduce repo? I can not local re-produce your error simply using latest app.module.ts import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { Log4jsModule } from '@nestx-log4js/core';
@Module({
imports: [
Log4jsModule.forRoot({
config: {
appenders: {
analyticsFileAppender: {
type: 'file',
maxLogSize: 20000,
keepFileExt: true,
layout: {
type: 'pattern',
pattern: '%d %p %z %f{1}:%l %m%n',
},
filename: `logs/api-server.log`,
},
analyticsConsoleAppender: {
type: 'console',
layout: {
type: 'pattern',
pattern: '%d %p %z %f{1}:%l %m%n',
},
},
},
categories: {
default: {
appenders: ['analyticsFileAppender', 'analyticsConsoleAppender'],
level: `debug`,
enableCallStack: true,
},
},
},
}),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {} main.ts import { NestFactory } from '@nestjs/core';
import { AppModule } from './app/app.module';
import { Log4jsLogger } from '@nestx-log4js/core';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const globalPrefix = 'api';
const port = process.env.PORT || 3333;
app.setGlobalPrefix(globalPrefix);
app.useLogger(app.get(Log4jsLogger));
const logger = app.get(Log4jsLogger);
await app.listen(port, () => {
logger.log('Listening at http://localhost:' + port + '/' + globalPrefix);
});
}
bootstrap(); console output
|
i use for categories don't take effect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you share a nestjs example in your usage along with the currently shared test scenarios. I have already configured log4js, but I needed nest system logs to be pushed to my configured logger for which I came across this library, but I am not able to configure it correctly.
I have added the suggested code of app.use(app.get(Log4jsModule)) in main.ts and in my app.module file I am trying to do
These configurations I have added to my nest library and simply exported getLogger() value, while trying to reuse the config from there I was not able to use it. Even after hard coding it like above it gives me error
I have even tried to put the basic config that you have added in your test example usage but stuck with the same issue.
If I only use Log4jsModule.forRoot() I am able to make it work, but it doesnt use my existing logger configurations. (Obviously, but wanted to state that with default it works.)
Online support of this library is very less, due to which I am posting this question here, Thanks in advance.
The text was updated successfully, but these errors were encountered: