Ok, I really should have thought about what I really needed before posting.
We have a "parent" GWT web application and we have children applications
that are plugged into it. The children can run as standalone web
applications but this is really only for development. Since each child
can run independently, each has its own logback.xml file.
Unfortunately, when the parent is built, the children are just JAR file
dependencies and the parent also has it's own logback.xml file.
Using only the parent's logback.xml file, we can configure different
appenders (and thus different log files) for each of the children, but
this only works because of the child namespacing (the Java package
name). The parent's logback.xml defines the root logger to use the
parent's appender. What this means is that if the children are using a
common framework, say Spring, all the Spring logging doesn't go into the
correct child's logfile, but rather the parent's.
What we need is a way to either allow each child it's own, completely
separate logging configuration or we need to "tag" the logging statement
in the parent's log file with some name that indicates which child the
message came from.
I was looking at the concept of a context selector, but it wasn't clear
how I'd be able to configure this to return the correct LoggingContext
depending on which child issued the logging statement.
Alternatively, I suppose I could add a filter which "sets" the current
logging context based on the request URI - the children's request URIs
are also namespaced so that each child's request URI always starts with
/child_name/...
Was this clear? Do anyone have any thoughts on how best to approach
this problem?
Thanks,
--adam
http://gordonizer.com