Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide way to rotate logs without being disruptive #253

Closed
riseuplabs opened this issue Nov 30, 2011 · 6 comments · May be fixed by enterstudio/etherpad-lite#51, enterstudio/etherpad-lite#52 or enterstudio/etherpad-lite#53
Assignees
Milestone

Comments

@riseuplabs
Copy link

As far as I can tell, the only way to rotate logs is to issue a restart of the service, which causes all clients to disconnect, it also initiates a full recheck of the npm and dependencies, which slows things down (e.g. /etc/init.d/etherpad-lite restart).

It would be ideal if we could do a 'kill -HUP' to a process to cause it to close the log file handle and open a new one, as this is the least disruptive mechanism for rotating logs, and is pretty common for services to use.

I tried to do a kill -HUP on the server.js process, but that just killed things outright.

@Pita
Copy link
Contributor

Pita commented Nov 30, 2011

afaik supports log4js logrotating. You may wanna dig into the documentation of log4js and do a pull request https://github.com/csausdev/log4js-node

Else this feature won't made it into 1.1

@riseuplabs
Copy link
Author

This shows a snippet with automatic logrotation built in: https://github.com/csausdev/log4js-node/blob/master/test/with-log-rolling.json

@Pita
Copy link
Contributor

Pita commented Nov 30, 2011

please implement it if you want that

@riseuplabs
Copy link
Author

It might be that this is supported already by log4js, but I haven't yet figured out how to make it work.

According to the log4js documentation, you should be able to drop a file called 'log4js.json' in "the current directory" (whatever that is), or in the require paths, and then log4js will pick it up automatically, by default, the configuration file is checked for changes every 60 seconds, and if changed, reloaded. This allows changes to logging levels to occur without restarting the application.

The logrotation 'snippit' in the comment above is supposed to be one of those log4js.json files that you could put somewhere and get logrotation for free. However, I've tried to put that in every location that I could think of, and it did not work. See my issue filed with log4js: https://github.com/csausdev/log4js-node/issues/47

@jhollinger
Copy link
Contributor

For what it's worth, several well-established projects (e.g. Ruby on Rails) do not offer this functionality, but instead recommend using logrotate with the "copytruncatae" setting. Basically it will copy your log, then delete the contents of the original. I imagine it would look like this on the command line: "cp ep.log ep.log.1 && cat /dev/null > ep.log". Obviously it's non-disruptive, but I don't know if there's a Windows equivalent.

@riseuplabs
Copy link
Author

thanks for the suggestion for copytruncate, I had forgotten about that option. I use that instead of trying to get log4js to work.

@ghost ghost assigned Pita Jan 9, 2012
muxator added a commit that referenced this issue Nov 25, 2019
This upgrade solves the high-severity vulnerabilities regarding
https-proxy-agent that were still present in 8e6bca4.

The output of `npm audit` goes from this:
  found 29 vulnerabilities (3 low, 26 high) in 13338 scanned packages
    run `npm audit fix` to fix 4 of them.
    1 vulnerability requires semver-major dependency updates.
    24 vulnerabilities require manual review. See the full report for details.

To this:
found 5 vulnerabilities (3 low, 2 high) in 13338 scanned packages
  1 vulnerability requires semver-major dependency updates.
  4 vulnerabilities require manual review. See the full report for details.


Changelog:
- https://github.com/npm/cli/releases

6.13.1 (2019-11-18)
    BUG FIXES
    938d6124d #472 fix(fund): support funding string shorthand (@ruyadorno)
    b49c5535b #471 should not publish tap-snapshot folder (@ruyadorno)
    3471d5200 #253 Add preliminary WSL support for npm and npx (@infinnie)
    3ef295f23 #486 print quick audit report for human output (@isaacs)

    TESTING
    dbbf977ac #278 added workflow to trigger and run benchmarks (@mikemimik)
    b4f5e3825 #457 feat(docs): adding tests and updating docs to reflect changes in registry teams API. (@nomadtechie)
    454c7dd60 #456 fix git configs for git 2.23 and above (@isaacs)

    DEPENDENCIES
    661d86cd2 make-fetch-happen@5.0.2 (@claudiahdz)

6.13.0 (2019-11-05)
    NEW FEATURES
    4414b06d9 #273 add fund command (@ruyadorno)

    BUG FIXES
    e4455409f #281 delete ps1 files on package removal (@NoDocCat)
    cd14d4701 #279 update supported node list to remove v6.0, v6.1, v9.0 - v9.2 (@ljharb)

    DEPENDENCIES
    a37296b20 pacote@9.5.9
    d3cb3abe8 read-cmd-shim@1.0.5

    TESTING
    688cd97be #272 use github actions for CI (@JasonEtco)
    9a2d8af84 #240 Clean up some flakiness and inconsistency (@isaacs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment