You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am testing your transport for Winston and for some reason it seems to be logging, but also causes my script to hang. My complete script is as follows:
var mysql = require('mysql');
var winston = require('winston');
winston.add(require('winston-graylog2'),
{
name: "Graylog",
level: "info",
silent: false,
handleExceptions: false,
graylog: {
servers: [
{
host: "localhost",
port: 12201
}
],
hostname: "test server",
bufferSize: 1400
},
staticMeta: {
application: "Test Job",
job: "test log job"
}
}
);
var connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '',
database: 'test'
});
connection.connect(function (err) {
if (err) {
winston.log('info', 'error connecting: ' + err.stack);
}
winston.log('info', 'connected as id ' + connection.threadId);
});
connection.query("SELECT COUNT(*) AS count FROM consumers", function (error, results, fields) {
winston.log('info', 'Querying clients table');
if (!error) {
winston.log('info', 'Count: ' + results[0].count)
}
if (error) {
winston.log('info', 'Query error ' + error);
}
});
connection.end(function (error) {
if (!error) {
winston.log('info', 'Closing ' + connection.threadId);
}
if (error) {
winston.log('info', 'Error closing connection: ' + error);
}
});
If I omit the winston-graylog2 require, it works fine, and completes immediately.
Any ideas? Thanks in advance for any help that you can provide.
The text was updated successfully, but these errors were encountered:
Unfortunately, it's a known issue (see #24), meaning that the problem is that unless the connection to graylog is closed, the script wont terminate. Im closing this for now since we already have #24 but we'd be happy to review PRs as this is something we banged our head against as well :)
Hello,
I am testing your transport for Winston and for some reason it seems to be logging, but also causes my script to hang. My complete script is as follows:
If I omit the winston-graylog2 require, it works fine, and completes immediately.
Any ideas? Thanks in advance for any help that you can provide.
The text was updated successfully, but these errors were encountered: