Paul,
OK. Here is the solution. Well, it's not much more than what you alluded to in your
initial mail.
<XFactory.java>
public class XFactory implements CategoryFactory {
static String parentFCQN = "org.apache.log4j.Category";
public XFactory() {
}
public
Category makeNewCategoryInstance(String name) {
return new XCategory(name, INSTANCE_FQCN);
}
}
<XCategory.java>
class XCategory extends Category {
static String XFQCN = "XCategory";
// the trick here is to have the XFactory to pass parentFCQN
protected
XCategory(String name, String instanceFQCN) {
this.name = name;
this.instanceFQCN = instanceFQCN;
}
void
forcedLog(String fcqn, ...) {
callAppenders(new MyNewTypeOfLoggingEvent(fqcn, ....));
}
void debug(Object msg) {
....
forcedLog(XFQCN, ...); <--- notice the XFQCN argument
}
}
Basically, the extender has to be aware the way meaning of the fcqn variable and of
how it is used to extract user information. I don't think this is that complicated
after all. Ceki
At 23:22 31.01.2001 +0100, you wrote:
>Paul,
>
>I am beginning to understand the issue. This is perhaps more complicated then I
>previously thought. Ceki
>
>At 22:54 31.01.2001 +0100, you wrote:
>
>>Paul,
>>
>>Is this log4j 1.0.4 or the CVS code? The code in CVS should work just fine. Or? Ceki
>>
>>At 13:07 31.01.2001 -0800, you wrote:
>>>Hi Folks,
>>>
>>>I'm having the following problem with the LocationInfo class when using
>>>subclasses of Category. LocationInfo assumes a stack trace of the
>>>following form.
>>>
>>>org.apache.log4j.FileAppender.doAppender
>>>org.apache.log4j.Category.callAppenders
>>>org.apache.log4j.Category.log
>>>callers.fully.qualified.classNames.methodName
>>>
>>>It assumes the caller's method comes just after the last Category entry on
>>>the stack. In the case of a Category subclass, there are at least two
>>>possibilities: the subclass overrides a logging method or it simply
>>>overrides the forcedLog method. In the former case the stack trace looks
>>>like:
>>>
>>>org.apache.log4j.Category.callAppenders
>>>org.apache.log4j.SubCategory.forcedLog
>>>org.apache.log4j.SubCategory.log
>>>callers.fully.qualified.className
>>>
>>>while in the later case it looks like
>>>
>>>org.apache.log4j.Category.callAppenders
>>>org.apache.log4j.SubCategory.forcedLog
>>>org.apache.log4j.Category.log
>>>callers.fully.qualified.className
>>>
>>>In the former class, the Category instance's instanceFQN should be set to
>>>SubCategory while in the later case it needs to be set to Category in order
>>>for the %C and %M of the PatternLayout to work properly. It would be nice
>>>if this could somehow be made consistent. I'm not sure what the answer is
>>>other than for the extender to be aware of this circumstance and set or not
>>>set the instanceFQN accordingly.
>>>
>>>Paul Glezen
>>>IT Specialist
>>>WebSphere Engagement Team
>>>Tel: 818 539 3321
>>>[EMAIL PROTECTED]
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>----
>>Ceki Gülcü - Independent IT Consultant
>>
>>av. de Rumine 5 Tel: ++41 21 351 23 15
>>CH-1005 Lausanne e-mail: [EMAIL PROTECTED] or
>>Switzerland [EMAIL PROTECTED]
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>
>----
>Ceki Gülcü - Independent IT Consultant
>
>av. de Rumine 5 Tel: ++41 21 351 23 15
>CH-1005 Lausanne e-mail: [EMAIL PROTECTED] or
>Switzerland [EMAIL PROTECTED]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
----
Ceki Gülcü - Independent IT Consultant
av. de Rumine 5 Tel: ++41 21 351 23 15
CH-1005 Lausanne e-mail: [EMAIL PROTECTED] or
Switzerland [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]