Git Product home page Git Product logo

Comments (8)

iccicci avatar iccicci commented on August 10, 2024 1

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

from rotating-file-stream.

iccicci avatar iccicci commented on August 10, 2024

Hi,

the first thing I see that could be cause of unexpected behaviour is:

if (!time) time = new Date();

in your filename generator.

This will cause your program to create the log file with a name which is function of the day when your program was launched.

I strongly suggest to change it in:

if (!time)
  return 'access.log';

Anyway I can't say if that is the root cause of the reported problem.

The error is clear: there is some write attempt after a close call.
RotatingFileStream will close by itself after an error... you can try to add an error event listener to check if that is the case:

accessLogStream.on('error', console.log.bind(console));

Please let me know about your progress with this issue.

Thank you,
iCC

from rotating-file-stream.

iccicci avatar iccicci commented on August 10, 2024

Hi man!

Any news about your issue?

from rotating-file-stream.

tobilg avatar tobilg commented on August 10, 2024

Hey @iccicci, thanks for your hints... I guess you're right regarding time. Works now.

from rotating-file-stream.

unliar avatar unliar commented on August 10, 2024
let logStream = rfs((index) => {
  return `${moment().format('YYYYMMDD')}.log`
}, {
  interval: '1d',
  path: logDir
})

i meet the same error when i wana use the date to name my logs file.

from rotating-file-stream.

unliar avatar unliar commented on August 10, 2024

@iccicci i have already read your suggestions, I‘ll update the code in the server in the midnight and check the log files later. thanks for your reply.

from rotating-file-stream.

iccicci avatar iccicci commented on August 10, 2024

Hi @unliar ,

any news about your issue?

from rotating-file-stream.

unliar avatar unliar commented on August 10, 2024

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

from rotating-file-stream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.