RODRIGO CARVALHO DOS SANTOS wrote:

   I know this is out of topic for this list, but is a common problem for
us all. I am using Log4J in my Struts app, and I need to use a component
encapsulated in a JAR file that uses Log4J too. How is the best way to
configure the Singleton Logger?

Have you used Log4J much? Typical use is that you instantiate a private static logger per class and name it after that class. An example of this can be found in the Struts User Guide ... and many, many other places. This is precisely how I would do a singleton or any other class.

I need to configure my loggers and the
component need to configure his own Loggers.

Unless the "component" has done something special or you do something special to make a different file be used, both configurations would reside in a single lo4j.properties file which is in the classpath.

I intend to encapsulate part of
my code as components that use Log4J, how should I document my configuration
needs?

If you follow convention, users of your components may, by knowing the package structure of your component and the class names, enable/disable logging in as coarse-/fine-grained way as they like.

  If any one has a good link for the topic, it will very helpfull.

See the log4j site. See the Struts User Guide for a short blurb. I would also examine commons-logging. By doing so, it suddenly becomes irrelevant if your users have chosen to use the jdk1.4 logger, log4j, or <insert favorite logging package here> - they all work equally well.

  Thanks in advance,
   Rodrigo Santos.

--
Eddie Bush





--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>

Reply via email to