2 Replies Latest reply on Feb 24, 2009 3:13 AM by div garg

    Console Halt

    div garg Newbie

      HI Everyone


      Here i am working on JBoss 4.2.2. I have a custom log4j xml file .Its content is:

      
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
      <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true" >
      
      
      
       <appender name="ROLLING" class="org.apache.log4j.DailyRollingFileAppender">
       <param name="File" value="${log4j.log.dir}/jbossatwork.log"/>
       <param name="Append" value="false"/>
       <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%d %-5p [%c][%t] - %m%n"/>
       <param name="Additivity" value="false"/>
       </layout>
      
      
       <filter class="com.propco.tools.mergemanager.profiles.Domfilter"/>
      
       </appender>
      
       <appender name="CONSOLE1" class="org.apache.log4j.ConsoleAppender">
       <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
       <param name="Target" value="com.propco.tools.mergemanager.profiles.Out1"/>
       <param name="Threshold" value="INFO"/>
       <layout class="org.apache.log4j.PatternLayout">
       <!-- The default pattern: Date Priority [Category] Message\n -->
       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
       </layout>
       </appender>
      
       <category name="com.propco">
       <priority value="DEBUG"/>
       <appender-ref ref="ROLLING"/>
       </category>
      
       <category name="org.apache">
       <priority value="WARN"/>
       </category>
      
       <root>
       <priority value="INFO"/>
       <appender-ref ref="ROLLING"/>
      
       </root>
      
      </log4j:configuration>
      


      Now the problem is sysouts come over the console untill my log4j is configured.At the time when my log4j is configured Sysouts stoped coming onto console.May be it is because of using other console appender than one which is in jboss-log4j.xml.But i can not remove my console appender.
      This is the content of Domfilter
      package com.propco.tools.mergemanager.profiles;
      
      import java.io.IOException;
      import java.net.InetAddress;
      import java.util.Vector;
      
      import org.apache.log4j.FileAppender;
      import org.apache.log4j.PatternLayout;
      import org.apache.log4j.spi.Filter;
      import org.apache.log4j.spi.LoggingEvent;
      
      import com.propco.login.LoginCheck;
      import com.propco.vo.ClientInfo;
      import com.propco.vo.LoginDetails;
      import com.propco.vo.PropCoSystemDomainVO;
      
      public class Domfilter extends Filter
      {
      
       InetAddress ip[]={ InetAddress.getLocalHost()};
      
      
       Vector<PropCoSystemDomainVO> vec;
       FileAppender appender,appender1;
       PatternLayout layout;
      
      
       public Domfilter() throws java.net.UnknownHostException, InterruptedException
       {
      
       System.out.println("hi123");
       layout=new PatternLayout();
      
       layout.setConversionPattern("%d %t %-5p [%c] %m%n");
       vec=LoginCheck.getAllDomains(new ClientInfo(ip));
       System.out.println(vec.size());
       String log4jConfig = System.getProperty("log4j.configuration");
       System.out.println(log4jConfig);
      
       System.out.println("Avinashhhhhhhhh"+vec.get(0).getDomainId());
       System.out.println("Avinashhhhhhhhh"+vec.get(1).getDomainId());
       System.out.println("Avinashhhhhhhhh"+vec.get(2).getDomainId());
      
       }
      
       public int decide(LoggingEvent event) {
      
       for(int i=0;i<vec.size();i++){
      
       System.out.println("Avinashhhhhhhhh");
      
       if( (((String)event.getMessage()).startsWith(vec.get(i).getDomainName())) )
       { try{
       appender = new FileAppender(layout,"C:\\rev2\\logs\\"+vec.get(i).getDomainName()+".log",true);
       }catch(IOException e){e.printStackTrace();}
       appender.doAppend(event);
       return Filter.DENY;
       }}
      
      
      
       return Filter.ACCEPT;
       }
      
      }
      
       }
       }
      System.out.println("Avinashhhhhhhhh"+vec.get(3).getDomainId());
      
      Above is the last console output.
      
      
      

      System.out.println("Avinashhhhhhhhh");


      Above is not coming on console


      And Console output is




      984 DEBUG [org.jboss.remoting.transport.socket.ClientSocketWrapper] reset timeout: 60000
      2009-02-20 17:20:05,296 INFO [STDOUT] Propco EJB Created
      2009-02-20 17:20:06,468 INFO [STDOUT] jar:file:/C:/jboss1/server/default/tmp/deploy/tmp24943propcooffice-ejb.jar!/djboss-log4j.xml <<<<<<<<<<<<urll>>>>>>>>
      2009-02-20 17:20:06,640 INFO [STDOUT] hi123
      2009-02-20 17:20:06,640 INFO [STDOUT] getting domains for 192.168.5.78
      2009-02-20 17:20:06,734 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: registering pool with interval 900000 old interval: 9223372036854775807
      2009-02-20 17:20:06,734 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: about to notify thread: old next: 1235131056734, new next: 1235131056734
      2009-02-20 17:20:08,640 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] Periodic recovery - first pass <Fri, 20 Feb 2009 17:20:08>
      2009-02-20 17:20:08,640 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] StatusModule: first pass
      2009-02-20 17:20:08,640 DEBUG [com.arjuna.ats.txoj.logging.txojLoggerI18N] [com.arjuna.ats.internal.txoj.recovery.TORecoveryModule_3] - TORecoveryModule - first pass
      2009-02-20 17:20:08,640 DEBUG [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.recovery.info.firstpass] Local XARecoveryModule - first pass
      2009-02-20 17:20:13,250 INFO [STDOUT] div4
      2009-02-20 17:20:13,250 INFO [STDOUT] div4
      2009-02-20 17:20:13,250 INFO [STDOUT] Client monika (192.168.5.78) matched with clientid local
      2009-02-20 17:20:13,250 INFO [STDOUT] JNDI Lookup=mysql-propcosystem
      2009-02-20 17:20:13,250 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: registering pool with interval 900000 old interval: 450000
      2009-02-20 17:20:14,218 INFO [STDOUT] div4
      2009-02-20 17:20:14,218 INFO [STDOUT] div4
      2009-02-20 17:20:14,218 INFO [STDOUT] div4
      2009-02-20 17:20:14,234 INFO [STDOUT] Client m (192.168.5.78) matched with clientid local
      2009-02-20 17:20:14,234 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] Client sans (192.168.5.78) matched with clientid local
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] Client Training1 (192.168.5.78) matched with clientid local
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] Client User (192.168.5.78) matched with clientid local
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] div4
      2009-02-20 17:20:14,265 INFO [STDOUT] Client Divya (192.168.5.78) matched with clientid newtraining
      2009-02-20 17:20:14,265 INFO [STDOUT] JNDI Lookup=mysql-propcosystem-newtraining
      2009-02-20 17:20:14,265 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: registering pool with interval 900000 old interval: 450000
      2009-02-20 17:20:15,046 INFO [STDOUT] div4
      2009-02-20 17:20:15,046 INFO [STDOUT] div4
      2009-02-20 17:20:15,046 INFO [STDOUT] div4
      2009-02-20 17:20:15,046 INFO [STDOUT] div4
      2009-02-20 17:20:15,046 INFO [STDOUT] div4
      2009-02-20 17:20:15,046 INFO [STDOUT] div4
      2009-02-20 17:20:15,046 INFO [STDOUT] 5
      2009-02-20 17:20:15,046 INFO [STDOUT] null
      2009-02-20 17:20:15,046 INFO [STDOUT] Avinashhhhhhhhh238
      2009-02-20 17:20:15,046 INFO [STDOUT] Avinashhhhhhhhh230
      2009-02-20 17:20:15,046 INFO [STDOUT] Avinashhhhhhhhh233
      2009-02-20 17:20:15,046 INFO [STDOUT] Avinashhhhhhhhh235
      
      

      2009-02-20 17:20:15,046 INFO [STDOUT] Avinashhhhhhhhh235


      After that no sysout is coming.Can anybody have any suggestions for it?
      Thanks
      Divya Garg

        • 1. Re: Console Halt
          jaikiran pai Master

          You do have the console appender in your log4j configuration:

          <appender name="CONSOLE1" class="org.apache.log4j.ConsoleAppender">
           <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
           <param name="Target" value="com.propco.tools.mergemanager.profiles.Out1"/>
           <param name="Threshold" value="INFO"/>
           <layout class="org.apache.log4j.PatternLayout">
           <!-- The default pattern: Date Priority [Category] Message\n -->
           <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
           </layout>
           </appender>


          But it's not configured against any logger. I would add it to the root logger as follows:




          <root>
           <priority value="INFO"/>
           <appender-ref ref="ROLLING"/>
           <appender-ref ref="CONSOLE1"/>
           </root>


          By the way, Divya, this is not the correct forum for this question :) This is more of a log4j question which is best answered either in log4j's mailing list or in our Installation & Configuration forum :)

          • 2. Re: Console Halt
            div garg Newbie

            Thanks for reply.

            Sir actually i want all the sysouts which are coming on console1 should also be logged on to Rolling file Appender.So i made Console1 as a child appender to Rolling Appender(Parent).

            Beside it i will also post same post to "Installation & Configuration forum".

            Thanks And Regards
            Divya Garg