Skip to content

Logging for all transport stop if fluent server is not available #115

@NetForces

Description

@NetForces

In the case where the fluent server becomes unavailable the logging for all transports stop logging and not only the fluent one.

I was able to reproduce this with a slightly modified version of the winston example:

const winston = require('winston');
const fluentNodeLogger = require('fluent-logger');

const logger = winston.createLogger({
  transports: [
    new (fluentNodeLogger.support.winstonTransport())(
      '___specialcustomtesttag',
      {
        host: 'localhost',
        port: 24224,
        timeout: 3.0
      }
    ),
    new winston.transports.Console({
      format: winston.format.combine(
        winston.format.colorize(),
        winston.format.printf(info => `${info.level} ${new Date().toISOString()} ${info.message}`)
      ),
    }),
  ],
});

(function repeatLog() {
  setTimeout(() => {
    logger.info('it works');
    repeatLog();
  }, 1000)
})();

Running this without any fluent listening on port 24224 will cause even the console log to stop after 16 loop.

If a fluent server is listening (or emulated with nc -lv 24224) it keeps on going till I stop the fluent server and then it keep on logging on the console for 16 loops and then stops logging. Restarting the fluent server does not make the logging (console and fluent) start again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions