You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Rex Madden <re...@microcreditcard.com> on 2001/01/27 21:09:59 UTC

Static vs. non-static categories and inner classes

I’m using the recommended approach to setting up Categories by software
component, so I generally use

            private static MyCategory cat =
(MyCategory)MyCategory.getInstance(ThisClass.class.getName());

The problem is, I sometimes use inner classes, and since they cannot have
static member variables, I have to either:

1.	Declare the category member variable as non-static.
2.	Simply use the outer class’s Category

I’d rather do number 1, but I’m not sure how mixing non-static and static
categories throughout my code will effect the logging output and
performance.  Does anyone know the ramifications of having not-static
categories?  Also, I’m using extended Category and Priority classes, if that
makes a difference (it shouldn’t)

Thanks,

Rex

P.S.  Sorry if this is a stupid question, but statics always make my head
hurt.