[logback-user] Logging to database

Aswani sriaswani at gmail.com
Mon Jan 12 17:50:20 CET 2009


Thank you Ceki.

Is there any appender in Logback to buffer all events of one user(per client
request)?
Is the CyclicBufferAppender or WriterAppender suitable for this requirement? 

Yes, writing to Database is slower than writing to file. That the reason we
are thinking of buffering the events and write them at once as a single
message(clob data). We are also thinking of making this DB process
asynchronous. 

Thanks in advance!!!
Aswani


Ceki Gulcu wrote:
> 
> 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
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
> 
> 

-- 
View this message in context: http://www.nabble.com/Logging-to-database-tp21417555p21418376.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list