[logback-user] Logging to database
Ceki Gulcu
ceki at qos.ch
Mon Jan 12 17:35:15 CET 2009
Hello Aswani,
SiftingAppender can help you separate logging output per user, for example to
separate files. However, it can also be used to encapsulate any other kind of
appender, not just FileAppender. You could in principle create an appender which
collects logging entries belonging to a user and then writing the results as a
database entry. SiftingAppender can deal with such an appender.
Note that by logging into a database, assuming you have MDC data, you can
perform SQL operations (select) resulting in the logs for a designated user.
However, logging to a database is slower than writing to a file.
Aswani wrote:
> Hi everyone,
>
> In our application we log all events of all users to one log file. As we
> have many users, suppprt has become difficult.
>
> So we are exploring better ways.
>
> we have two options:
>
> 1) Seperating logging to different files, like one file per user.
> - There is a SiftingAppender in logback that serves this purpose.
>
> 2) Logging to database. (Our team is interested in this option)
> - Not one event at a time. Buffering all events of one client request
> and write all those buffered messages as one single string to Database at
> the end of the request. So the buffer should be thread local, or one buffer
> per user.
> I am just wondering is this possible with SiftingAppender?
> I saw CyclicBufferAppender in logback apidocs. But there is no documentation
> for that. If this appender is not for that purpose, Is there any appender
> that suits my requirement?
>
> So, I am thinking, instead of a FileAppender in the SiftingAppender, can we
> have any other appender that buffers all logging events of one client
> request?
>
> Am I thinking in the right direction?...
>
> Please help me in this regard...
> Thanks in advance!!!
>
> Aswani
>
>
>
>
--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
More information about the Logback-user
mailing list