On Apr 5, 2007, at 12:17 PM, mehmet bilgin wrote:
i am using log4j with jboss application server.the smtpappender
doesnot fulfill my needs so i write another smtpappender.this
appender has an attribute name String mailTo.so you can change the
mailto address from the xml file.i have an asyncappender which
contains a reference to the my smtpappender.since jboss also uses
log4j and it has a log4j.xml file i write my loggers in that
file.and as you know jboss has a thread that checks whether this
file changed or not.
think of a position that asyncappender has 5 event in its queue. at
that moment if i make a change in the log4j.xml file jboss thread
tries to update themailTo field of my appender. But since there is
an ongoing event in that appender this thread is get blocked.if
again at that moment i send another event to my appender it also
gets blocked (so my sessionbean gets blocked).what happens is first
the 5 events in the queue is processed and then the mailTo field
updated and finallymy session bean finishes the logging event.
what i want is my session bean never gets blocked. how can i do that.
Since you are using blocking=false on AsyncAppender, I assume that
you are using a very recent log4j (either 1.2.13 or .14 if I remember
correctly). However, I don't think that is directly related to your
issue.
I would try to find a different way to communicate the change of
email address instead of modifying log4j.xml. I'm speculating since
I've never dug into the sequence of events that occur when a
configuration is changed. My speculation that a modification of
log4j.xml would block almost all of log4j and would force all the old
appenders to complete any pending tasks (like processing the rest of
the logging events in the queue) before rebuilding the
configuration. That would be consistent with the behavior you
observed. I don't think (but could be wrong) that there is logic to
detect only the changes from the previous configuration and to not
touch unmodified appenders. If your new log4.xml file contains an
AsyncAppender, then I believe the old one must be closed (which would
block until the queue is finished) before it is replaced with an
newly constructed one.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]