[logback-dev] vote for extending the AbstractSocketAppender

Tony Trinh tony19 at gmail.com
Wed Sep 17 01:57:06 CEST 2014


On Sat, Jul 5, 2014 at 10:14 AM, Sebastian Gröbler <
s.groebler at googlemail.com> wrote:

> Hey Logback-Devs,
>
> I recently developed an “FileBufferingSocketAppender” for the
> logback-android (see https://github.com/tony19/logback-android/pull/57) project
> in order to have a more robust SocketAppender implementation.
> The appender basically buffers events to disk so in case of a crash or
> connection problem no events are being lost. This is especially an
> important feature for crash-reporting on android devices.
> After some discussions with Tony we decided that it might make sense to
> put this Appender in either the logback, logback-contrib or
> logback-extension project and refer to it from the logback-android project,
> because the feature it self is not really specific to android.
>
> The FileBufferingSocketAppender was initially developed before the
> AbstractSocketAppender got the internal queue to buffer events in memory.
> After some thinking I found that my FileBufferingSocketAppender is
> basically not much different to the most recent implementation of the
> AbstractSocketAppender.
> The only difference is the way the events are being buffered (in-memory
> vs. on-disk), which I think could be configurable.
>
> So I am asking the logback developers for their opinion:
>
> Does it makes sense to make the queue implementation of the
> AbstractSocketAppender configurable? The default would stay the same, but
> the user would also be able to either provide his own implementation or
> choose between in-memory and on-disk.
>
>
Hi Sebastian,

Since AbstractSocketAppender provides an API for subclasses to specify
QueueFactory, I think that would be a great extension point for users to
specify a file-backed queue. The default implementation would return
LinkedBlockingDeque to maintain the current behavior.

Then, you could add your FileBackedSocketAppender to logback-contrib or
logback-extensions. This appender would extend AbstractSocketAppender,
constructed with a custom QueueFactory that returns a file-backed queue
(such as QueueFile from Square Tape <http://square.github.io/tape/>).

Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-dev/attachments/20140916/098bccaf/attachment.html>


More information about the logback-dev mailing list