Forwarding messages to graylog after a network outage

When we use Java with log4j or logback and set an appender to forward messages to Graylog, how can we fill the gap in messages after a network outage?
We are looking for an addon or some other solution that will recover from a network outage and send missing messages from the time the client was offline.