[logback-user] Advice please

Jesse Long jpl at unknown.za.net
Wed Jul 21 16:02:23 CEST 2010


Hi All,

Please advise me whether the following is possible, and how to go about 
implementing it in Logback.

I have a web app, with servlets for the web pages, as well as soap web 
services. Additionally, I have some background threads that do all sorts 
of interesting things. The servlets, web services and background threads 
all use the same data model classes which are backed by an orm data 
access layer, which uses JDBC to get data from a DB.

I want all logging that happens while handling a servlet request to go 
to one log file, all logging that happens while handling a soap web 
service call to go to another log file, and all logging that happens in 
a background thread to go to another log file. Also, I want to log all 
the data model, orm and JDBC layer information to separate log files at 
debug and up level.

For example, imaging the following list of log events (in this order):

Logger    Level Expected log files
x.soap    info  soap.log
x.model   info  soap.log,model.log
x.orm     debug orm.log
x.orm     info  soap.log,model.log,orm.log
x.jdbc    debug jdbc.log
x.jdbc    info  soap.log,model.log,orm.log,jdbc.log

x.soap calls x.model, which calls x.orm, which calls x.jdbc. Similar 
traces for x.servlet, x.helperthread etc.

I cant use Logger name to decide which appenders log, but what can I 
use? How can I achieve this?

I would appreciate any pointers.

Thanks,
Jesse


More information about the Logback-user mailing list