Uploaded image for project: 'MariaDB Connector/node.js'
  1. MariaDB Connector/node.js
  2. CONJS-265

permit configuration of console warning message to be exported

Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 3.2.1
    • configuration
    • None

    Description

      see https://github.com/mariadb-corporation/mariadb-connector-nodejs/issues/249
      `logger` configuration permit to log error/query/network messages, but there is still some remaining messages that are send to console.

      Those are configuration warnings and pool leaking warnings.
      Goal is to provided a solution to permit external logging for those warnings.

      Attachments

        Activity

          diego dupin Diego Dupin added a comment -

          If no warning logger is set, those warning will still be written on console.

          Here is an example of use :

          const mariadb = require('mariadb');
          const winston = require('winston');
           
          const logger = winston.createLogger({
            level: 'info',
            transports: [
              // - Write all logs with level `error` and below to `error.log`
              // - Write all logs with level `info` and below to `combined.log`
              new winston.transports.Console({ filename: 'error.log', level: 'error' }),
              new winston.transports.Console({ filename: 'combined.log' })
            ]
          });
           
          const pool = mariadb.createPool({
            host: 'mydb.com',
            user:'myUser',
            password: 'myPwd',
            logger: {
              network: (msg) => logger.silly(msg),
              query: (msg) => logger.info(msg),
              error: (err) => logger.error(err),
              warning: (msg) => logger.warn(msg),
            }
          });
          

          diego dupin Diego Dupin added a comment - If no warning logger is set, those warning will still be written on console. Here is an example of use : const mariadb = require( 'mariadb' ); const winston = require( 'winston' );   const logger = winston.createLogger({ level: 'info' , transports: [ // - Write all logs with level `error` and below to `error.log` // - Write all logs with level `info` and below to `combined.log` new winston.transports.Console({ filename: 'error.log' , level: 'error' }), new winston.transports.Console({ filename: 'combined.log' }) ] });   const pool = mariadb.createPool({ host: 'mydb.com' , user: 'myUser' , password: 'myPwd' , logger: { network: (msg) => logger.silly(msg), query: (msg) => logger.info(msg), error: (err) => logger.error(err), warning: (msg) => logger.warn(msg), } });

          People

            diego dupin Diego Dupin
            diego dupin Diego Dupin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.