0

Does log4php support buffering of logs before writing to the disk? If so, is it possible to control the buffer size or the time limit after which the logs will be written to disk (similar to the control offered in nginx access_log file)?

Sven
  • 69,403
  • 10
  • 107
  • 109
Mohan P
  • 389
  • 1
  • 5
  • 11

1 Answers1

0

The answer is no. You could try to implement that behavior in a newly created appender, but beware that this is possibly a dangerous operation: PHP would be required to store the logs in memory, and it wouldn't be able to write them to disk if the script crashes. So logging wouldn't be able to help you debug problems, because all traces would be lost.

You should investigate using the syslog appender instead. If you are able to influence the nginx configuration, you seem to be root on the machine. Syslog might be able to offer you all you need, and Log4php would simply send the log at the very moment something happens.

Sven
  • 69,403
  • 10
  • 107
  • 109