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.

Rotate fails with applicatoin shutdown

See original GitHub issue

I see the following in my application’s logs:

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: write after end
    at writeAfterEnd (_stream_writable.js:193:12)
    at RotatingFileStream.Writable.write (_stream_writable.js:240:5)
    at Array.logRequest (/usr/local/dcos-universe-browser/node_modules/morgan/index.js:130:14)
    at listener (/usr/local/dcos-universe-browser/node_modules/on-finished/index.js:169:15)
    at onFinish (/usr/local/dcos-universe-browser/node_modules/on-finished/index.js:100:5)
    at callback (/usr/local/dcos-universe-browser/node_modules/ee-first/index.js:55:10)
    at ServerResponse.onevent (/usr/local/dcos-universe-browser/node_modules/ee-first/index.js:93:5)
    at emitNone (events.js:91:20)
    at ServerResponse.emit (events.js:185:7)
    at finish (_http_outgoing.js:596:10)

This occurs every night at 00:00 UTC. I use it like this:

// Create a rotating write stream
var accessLogStream = rotatingFileStream(function(time, index) {
    if (!time) time = new Date();
    return 'access-' + time.toISOString().substr(0,10).split('-').join('') + '.log'
}, {
    interval: '1d',  // rotate daily
    path: logDirectory
});

Is there a hint where the problem can arise from? Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
icciccicommented, Aug 17, 2017

Your filename generator function does not accept the time parameter. Change this and apply same change I already suggested…

0reactions
unliarcommented, Aug 22, 2017

@iccicci everything goes well. many thanks for your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected display rotation after you close an application in ...
In this scenario, when you close the application or the volume control, the screen returns to desktop in the native display orientation. Cause....
Read more >
Android application stop unexpectedly when rotate
As for the "unexpected" stop, it is because when you rotate, the Activity is reloaded (onCreate is run again, etc), and you probably...
Read more >
How to Fix Auto Rotate Not Working on Android
Fix Auto-Rotate Issues by Restarting Your Android Phone · Turn On Screen Rotation From Android Settings · Use the In-App Screen Rotation Option....
Read more >
7 ways to fix Android screen rotation not working - Carlcare
7 ways to fix Android screen rotation not working · Restart your phone · Check Auto-rotation settings · Calibrate phone's sensors · Check...
Read more >
Prevent Android app from restarting on rotate / hardware ...
Problem. When I rotate the device (change orientation) or pop out the hardware keyboard, my Activity gets paused ( onPause() ), stopped ...
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