Hi

I have been using log4j for 2 days now, and I dare to make a comment:), but
first some background:

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
(maybe because I was using rootCategory??), but suddenly I got
"ClassCastException". It was impossible to debug, because the error was
probably caused before runtime? (that is, in the static blocks, class
initialization) However, I suspected it had to do with log4j. I tried a
lot, and read the "short introduction" over and over again:) Then, at last,
I got the bright idea to check the javadoc for PropertyConfigurator:

Class Factories
In case you are using your own subtypes of the Category class and wish to
use configuration files, then you must set the categoryFactory for the
subtype that you are using.

The syntax is:
log4j.categoryFactory=fully.qualified.name.of.categoryFactory.class

Even though it had worked (hadn't it?) before, I was pretty sure that
*this* was my problem. I first tried to write my Factory with a .class
extension, but that was obviously wrong (why add that .class in the
javadoc?) At last it worked!

Some comments/questions:
1) I doesn't seem to logical to have "log4j.categoryFactory" as a key, when
(if) you have multiple factories. Will it work? Wouldn't it be more
intuitive to have "log4j.<category>.factory" as the key?
2) Why did I get a ClassCastException, and not an error message telling me
that I was missing a key-value pair in the propertyfile?
3) Why do we need to add this property at all? Does it have to be this way?

I also spend some time before I got the clue about how to override
additivity. My intuition said something like this:

log4j.category.<mycat>.additivity=false

correct answer is:

log4j.additivity.<mycat>=false.

However, the correct answer is only (I think!) to be found in the example
in the PropertyConfigurator-javadoc.

BUT!! Log4j works wonderfully AND I'm very pleased with it. Thank you to
all of you that has worked with it! My comments are probably not very well
formed, and the best way to view them, is from at newbie's perspective.

Any comments are appreciated.

mvh
Morten Simonsen


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

Reply via email to