question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Winston crashes process (solved) & does NOT reconnect to Papertrail after LOST connection (open)

See original GitHub issue

Hi guys,

woohhhaaa! my winston setup crashes the process when the connection to papertrail is lost:

    "winston": "^3.2.1",
    "winston-papertrail": "^1.0.5"
        const papertrailLogger = new winston.transports.Papertrail({
            // for options see https://github.com/kenperkins/winston-papertrail
            host,
            port,
            level: 'info',
            logFormat(level, message) {
                return `[${level}] ${message}`
            },
            inlineMeta: true,  // attach meta data inline (TODO switch it off completely see https://github.com/kenperkins/winston-papertrail/issues/85)
        })
        papertrailLogger.on('error', (err) => {
            // Handle, report, or silently ignore connection errors and failures
            console.error('[Log] papertrailLogger.error', err)
        })
        transports.push(papertrailLogger)
ERROR:
{ Error: write EADDRNOTAVAIL
W20191014-09:57:04.888(2)? (STDERR)     at _errnoException (util.js:992:11)
W20191014-09:57:04.888(2)? (STDERR)     at WriteWrap.afterWrite (net.js:864:14)
W20191014-09:57:04.888(2)? (STDERR)   code: 'EADDRNOTAVAIL',
W20191014-09:57:04.888(2)? (STDERR)   errno: 'EADDRNOTAVAIL',
W20191014-09:57:04.889(2)? (STDERR)   syscall: 'write' }
W20191014-09:57:04.889(2)? (STDERR) events.js:183
W20191014-09:57:04.889(2)? (STDERR)       throw er; // Unhandled 'error' event
W20191014-09:57:04.889(2)? (STDERR)       ^
W20191014-09:57:04.890(2)? (STDERR) 

and

W20191014-09:57:10.430(2)? (STDERR) [Log] papertrailLogger.error { Error: getaddrinfo ENOTFOUND logsXXXX.papertrailapp.com logsXXXX.papertrailapp.com:123124
W20191014-09:57:10.430(2)? (STDERR)     at errnoException (dns.js:50:10)
W20191014-09:57:10.430(2)? (STDERR)     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
W20191014-09:57:10.431(2)? (STDERR)   code: 'ENOTFOUND',
W20191014-09:57:10.431(2)? (STDERR)   errno: 'ENOTFOUND',
W20191014-09:57:10.431(2)? (STDERR)   syscall: 'getaddrinfo',
W20191014-09:57:10.431(2)? (STDERR)   hostname: 'logsXXXX.papertrailapp.com',
W20191014-09:57:10.431(2)? (STDERR)   host: 'logsXXXX.papertrailapp.com',
W20191014-09:57:10.431(2)? (STDERR)   port: 123124 }
W20191014-09:57:10.431(2)? (STDERR) events.js:183
W20191014-09:57:10.432(2)? (STDERR)       throw er; // Unhandled 'error' event
W20191014-09:57:10.432(2)? (STDERR)       ^
W20191014-09:57:10.432(2)? (STDERR) 
W20191014-09:57:10.432(2)? (STDERR) Error: getaddrinfo ENOTFOUND logsXXXX.papertrailapp.com logsXXXX.papertrailapp.com:123124
W20191014-09:57:10.432(2)? (STDERR)     at errnoException (dns.js:50:10)
W20191014-09:57:10.432(2)? (STDERR)     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)

I wouldn’t expect a pro-logger library to need a try-catch.

Is this package still maintained?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
kdolancommented, Oct 25, 2019

I have same issue with no ability to reconnect. I have had that issue for a while now, it’s rather annoying. If anybody has a fix for this it would be much appreciated.

0reactions
KTruong008commented, Oct 11, 2021

Been having the same issue for a while too, and switching to the syslog transport, or adding handleExceptions to the transport and logger doesn’t prevent the crash for my apps. I’ve been thinking of switching to http logs but I don’t know if it’s going to have the same problem too or if it’s just going to be much slower.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting reachability - Papertrail
Papertrail automatically closes idle TCP connections after 15 minutes of inactivity. Log senders should already handle this as part of a full implementation, ......
Read more >
Best Practices for Logging in Node.js - Papertrail
Below we will show you how you can turn on logging using popular libraries such as Winston and Bunyan. Next, it's important to...
Read more >
Node.js - Papertrail
Papertrail can accept logs from any Node.js app using a regular text log file or the libraries winston or bunyan . If the...
Read more >
How to Live Tail Docker Logs - Papertrail
Therefore, you won't see any logging or other output from your Docker container. To display these valuable logs, you can use a range...
Read more >
How to Diagnose App Issues Using Crash Logs - Papertrail
If you're connecting a device for the first time, a prompt might show up on your Android device requesting permission to let ADB...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found