In my session bean I use object of  Parent class:


  | public  class Parent{
  |   protected static Logger log;
  | 
  |   public  Parent(String log4jCategory){
  |            log =Logger.getLogger(log4jCategory);
  |   }
  | 
  |  ....
  | }
  | 
  | public class ChildA extends Parent {
  |      ....
  | }
  | 
  | public class ChildB extends Parent {
  | ....
  | }
  | 
  | 
  | 
  | 
  | public class MyBean implements javax.ejb.SessionBean {
  |      private Parent  obj;
  |      ....
  |      public void initParentObject(String paramValue){
  |           if (paramValue.equals("A"))
  |              obj = new ChildA("CategoryA");
  |           else 
  |              obj = new ChildB("CategoryB");
  |      }
  |      ....
  | }
  | 
  | 

Is it possible to get log data to diferrent file depending on Child class 
realization.

Of course, it can be done in such way in log4j.xml:

  | 
  |   <appender name="CHILD_A" 
  |      .....
  |   </appender>
  | 
  |   <appender name="CHILD_B" 
  |      .....
  |   </appender>
  | 
  | 
  |   <category name="mypack.ChildA">
  |     <appender-ref ref="CHILD_A"/>       
  |   </category>
  | 
  |   <category name="mypack.ChildB">
  |     <appender-ref ref="CHILD_B"/>       
  |   </category>
  | 
  | 


But in reallife realization, there are a lot of classes in  ChildA and   ChildB
from different packs, which has their  Loggers and they have to write to the 
same file.  That's why I cannot use many different  categories in  log4j.xml   
putting  only classpath like "mypack.ChildB"


As I see in wiki "Separating Application Logs",  I can use CLFilter:
           


  | <filter class="org.jboss.logging.filter.TCLFilter>
  |           <param name="AcceptOnMatch" value="true">
  |           <param name="DeployURL" value="app1.ear">
  | 

But here I have to put a EAR name// but in my examle - I want to have 2 
different logs in same bean.

We use JBOSS 3.2.1

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127350#4127350

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127350
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to