Well, I don't *have* to, but I have a special type of Exception, which
contains a stack of previous caught exceptions. My exception also
contains a priority among others. Thus, I want to print the complete
list of exceptions according to the loglevel/priority + stack-number and
so on.

To do this I, I think my options in Log4J are:
1) Write a subclass of Category, with a method like this:
     ExceptionCategory.log(MyException me);
which in turn will call Category.fatal(String s) where s is the computed
logstring.
2) I can make a method in my own converter-class, like this:
     MyException me = new MyException(1000,new String[]
{some,run,time,values},caughtThrowable);
     String computedLogString = Converter.translateS(me);
     Priority p = Converter.translateP(me)
     cat.log(computedLogString, p); // or whatever the log-method accepts.
The latter seem to be unecessary when I can use the first? It may be that
this Nested Diagnostic Context will do, but I honestly don't know how this
will apply to my 'problem'. But because of the possibility of subclassing
Category, and would say that my needs are being met.


>Why did you think it was necessary to make a subclass of Category? I
>don't understand what you mean by you need to log your exceptions your
>way. How were your needs not being met?

-- Don

>> I had to make a subclass of Category, in order to log my exceptions
>> my way. Then I made an ExceptionCategoryFactory. At first this seemed
>> to work



mvh
Morten Simonsen



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

Reply via email to