Project

General

Profile

MHHow to control log file size

Added by Mario Hegele about 6 years ago

Hi,

the logger output can be redirected from stderr to a file with WLogger::setFile(path).

How can I prevent this file from becoming too big?
I found a 7 year old post about rotating log files but with no outcome.

Is there a Wt way to do it?
Or do you suggest other measures like not using the above-mentioned function and controlling the stderr output outside the Wt application?

Yours,
Mario


Replies (3)

RS RE: How to control log file size - Added by Roel Standaert about 6 years ago

Wt has no built-in log rotation, indeed. My suggestion would be to just use something like logrotate to rotate the logs. That's what we usually do.

There are many alternatives, like starting Wt as a systemd service, and have its stderr automatically put in the journal.

If you're using Windows, I don't know about that, there's probably something similar that exists for Windows.

MH RE: How to control log file size - Added by Mario Hegele about 6 years ago

Thank you,
sounds like an applicable solution for us.

SB RE: How to control log file size - Added by Stefan Bn about 6 years ago

Roel Standaert wrote:

If you're using Windows, I don't know about that, there's probably something similar that exists for Windows.

For Windows there is "Windows Service Wrapper" that wraps an (Wt) executable into a windows service. WinSW has several options to control log file size and rotation.

https://github.com/winsw/winsw

Best,
Stefan

    (1-3/3)