This is probably something trivial but here I go.


I'd like to have two distinct web-applications running on the same
servlet container to log to different chainsaw panels.

(I am using the latest code from CVS head.)

1st attempt)
------------

The servlet container is started with the following argument:

java -Dlog4j.repositorySelectorClass=jndi ...some.servlet.container

'jndi' is a special keyword. You can replace 'jndi' with
'org.apache.log4j.selector.ContextJNDISelector' if you like.

This installs a ContextJNDISelector instead of the default
selector. You can than add special environment entires in each
web-application's web.xml files. These JNDI environment entries tell
ContextJNDISelector which repository to use for which web-app.

Here are the config files for each app:

--- WEB-APP1-logging.properties------
log4j.debug=true
log4j.rootLogger=ALL, CON, CS
log4j.appender.CON=org.apache.log4j.ConsoleAppender
log4j.appender.CON.layout=org.apache.log4j.PatternLayout
log4j.appender.CON.layout.ConversionPattern=APP1 %d %-5p %c - %m%n

log4j.appender.CS=org.apache.log4j.net.SocketAppender
log4j.appender.CS.remoteHost=localhost
log4j.appender.CS.port=4560
log4j.appender.CS.Log4jApp=APP1
---------------------------------------------

--- WEB-APP2-logging.properties------
log4j.debug=true
log4j.rootLogger=ALL, CON, CS
log4j.appender.CON=org.apache.log4j.ConsoleAppender
log4j.appender.CON.layout=org.apache.log4j.PatternLayout
log4j.appender.CON.layout.ConversionPattern=APP2 %d %-5p %c - %m%n

log4j.appender.CS=org.apache.log4j.net.SocketAppender
log4j.appender.CS.remoteHost=localhost
log4j.appender.CS.port=4560
log4j.appender.CS.Log4jApp=APP2
---------------------------------------------

These two config files are correctly picked by the two different
logger repositories.

I then started chainsaw and manually added a socket receiver on port
4560 (the default).

The logging events from app1 and app2 reach chainsaw just fine. They
are displayed but unfortunately under the same tab. Note that the
applications set distinct values for the log4jApp property. This is
visible from the detail pane in chainsaw.

Is there a way to have events with distinct log4jApp properties
directed to distinct tabs?

2nd attempt:
------------

I used two SocketReceivers with different ports and configured two
SocketAppenders to use the different values.  The events get to
chainsaw but still under the same tab.

What am I missing? Thanks in advance.

--

Ceki Gülcü

For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to