JBoss is heirarchial.  Jboss initializes it, and therefore your logging 
messages would utilize there root category appenders.  This is 
configured in the <jboss root dir>/server/<instance>/conf/log4j.xml 
file, where instance is (out of the box) either all, default, or 
minimal.  If your running out of the box then its default.

The question is whether or not this is a good approach is up to you. 
This is the best approach I can think of.
- Include log4j.jar with your EAR and declare the dependency in the 
EJB's Manifest file.  (this is so you can deploy on other servers, for 
example an app server that doesn't already have log4j on the classpath)
- Include log4j.properties in your classpath of your ejb's.  (if you 
don't want to use the system configuration)
- Include the following as a field in your EJB's

private Logger log = Logger.getLogger(this.getClass());

- if you have log4j.properties on your classpath this will use that when 
instantiated log4j by default, however if it is already instantiated you 
will use that configuration.

I usually modify log4j.xml and create a seperate RollingFileAppender, 
for my specific catalogs.

Hope this helps.

Mike


> I'm not sure as to how JBoss will maintain one instance of my Logger 
> class.  Will my classes (even just plain old java classes that are 
> called by a servlet etc) somehow use the same instance of the logger 
> class that JBoss is using - and therefore I can use the log4J settings 
> that come with JBoss, of do I need to include a separate configuration 
> file and if so when would I initialise it?
> 
>  
> 
> Any help or words of wisdom would be appreciated.
> 
>  
> 
>  
> 
> Regards
> 
>  
> 
>  
> 
> Alan.
> 
>  
> 
>  
> 
>  
> 


-- 
<Mike/>




-------------------------------------------------------
This sf.net email is sponsored by: Jabber - The world's fastest growing 
real-time communications platform! Don't just IM. Build it in! 
http://www.jabber.com/osdn/xim
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to