I'm using log4js to log messages. For some reason, the logger automatically logs the http calls, and I can't find a way to disable it. Here is my code:
// Initialize the log4js logger by configurations parameters and appenders.
log4js.configure({
appenders: {
app: {
type: 'file',
filename: 'logs/app.log',
pattern: '-yyyy-MM-dd',
maxLogSize: LOGS_FILES_MAXIMUM_SIZE
},
mq: {
type: '@log4js-node/rabbitmq',
host: LOG_SERVER_HOST_ADDRESS,
port: LOG_SERVER_HOST_PORT,
username: LOG_SERVER_USERNAME,
password: LOG_SERVER_PASSWORD,
routing_key: LOG_SERVER_ROUTING_KEY,
exchange: LOG_SERVER_EXCHANGE_NAME,
mq_type: 'direct',
durable: true
}
},
categories: {
default: { appenders: ['app'], level: LogLevel.ALL },
development: { appenders: ['app'], level: LogLevel.ALL },
production: { appenders: ['app', 'mq'], level: LogLevel.ALL }
}
});
this.log = log4js.getLogger('production');
and in app.js
this.app.use(log4js.connectLogger(log4js.getLogger('production'), { level: 'off' }));
For some reason the logger automatically log messages like this:
[2019-06-19T16:02:16.182] [OFF] development - ::1 - - "POST /api/log/logMessage HTTP/1.1" 200 2 "http://localhost:3000/?recording-session-id=b983cb82-4812-4c43-87b3-a17e7ed1f6b4&environment=data-center" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36" [2019-06-19T16:02:16.182] [OFF] development - ::1 - - "OPTIONS /api/stream/getStreamData HTTP/1.1" 204 0 "http://localhost:3000/?recording-session-id=b983cb82-4812-4c43-87b3-a17e7ed1f6b4&environment=data-center" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36" [2019-06-19T16:02:16.189] [OFF] development - ::1 - - "POST /api/stream/getStreamData HTTP/1.1" 200 999 "http://localhost:3000/?recording-session-id=b983cb82-4812-4c43-87b3-a17e7ed1f6b4&environment=data-center" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36"