11 Replies Latest reply on Feb 9, 2009 6:58 AM by div garg

    JBoss Consol

    div garg Newbie

      Hi

      Here i am working Jboss 4.2.2. I have a JBoss Central Server to which many clients are attached. I have created some sysout statements at server side for debugging.And they are coming to console and they are same for every client. Now my problem is I want to distinguish these sysouts for every client so that i figure out which sysout related to which client. Can anyone help me here. And if there is any related topic then please let me know.

      Thanks And Regards
      Divya Garg

        • 1. Re: JBoss Consol
          jaikiran pai Master

          Please do not post the same question in multiple forums http://www.jboss.com/index.html?module=bb&op=viewtopic&t=149952

          • 2. Re: JBoss Consol
            div garg Newbie

            Sorry Sir

            Actually i have posted this question first on beginers corner but as the confermation i did not get the message on my mail so i thought i did not reached to the viewer , then i posted same question here.

            Thanks And Regards
            Divya Garg

            • 3. Re: JBoss Consol
              Peter Johnson Master

              You will never get mail regarding your own posts, only for posts others made.

              • 4. Re: JBoss Consol
                div garg Newbie

                Hi


                Sorry sir. Actually I was not aware of that same post we can not send to more than one forum. I really sorry.

                THanks And Regards
                Divya Garg

                • 5. Re: JBoss Consol
                  jaikiran pai Master

                   

                  "div_gcet1" wrote:
                  Hi


                  Sorry sir. Actually I was not aware of that same post we can not send to more than one forum.



                  That's OK :) The above replies were just as a FYI and also to help you use the forums in a better way :)


                  • 6. Re: JBoss Consol
                    div garg Newbie

                    Hi

                    I am working on JBoss Logs Filtering.I have made a custom log4j
                    file(jbossatwork.xml) that contain the entry of a java filter file in
                    com.propco.tools.mergemanager.profiles package.This file contain the
                    filtering concept.It is creating the log files with the name of domain in
                    C:\\rev2\\logs\\ location. We can change this location according to our
                    requirments. Now my problem is it is filtering the log statements in
                    coding but not sysouts.Please help me.

                    THis is my log4j file.

                    <?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] - %m%n"/>
                     </layout>
                    
                    
                     <filter class="com.propco.tools.mergemanager.profiles.Domainfilter"/>
                    
                     </appender>
                    
                     <category name="com.propco">
                     <priority value="DEBUG"/>
                     <appender-ref ref="ROLLING"/>
                     </category>
                    
                     <category name="org.apache">
                     <priority value="WARN"/>
                     </category>
                    
                     <root>
                     <priority value="WARN"/>
                     <appender-ref ref="ROLLING"/>
                     </root>
                    
                    </log4j:configuration>
                    
                    
                    


                    And this is my filter file.
                    
                    package com.propco.tools.mergemanager.profiles;
                    
                    import org.apache.log4j.FileAppender;
                    import org.apache.log4j.PatternLayout;
                    import org.apache.log4j.spi.Filter;
                    import org.apache.log4j.spi.LoggingEvent;
                    import java.io.IOException;
                    import java.net.InetAddress;
                    import java.util.Vector;
                    import com.propco.login.LoginCheck;
                    import com.propco.vo.ClientInfo;
                    import com.propco.vo.PropCoSystemDomainVO;
                    
                    public class Domainfilter extends Filter
                    {
                    
                     InetAddress ip[]={ InetAddress.getLocalHost()};
                    
                    
                     Vector<PropCoSystemDomainVO> vec;
                     FileAppender appender,appender1;
                     PatternLayout layout;
                    
                    
                     public Domainfilter() throws java.net.UnknownHostException, InterruptedException
                     {
                    
                    
                     layout=new PatternLayout();
                     layout.setConversionPattern("%d %-5p [%c] %m%n");
                     vec=LoginCheck.getAllDomains(new ClientInfo(ip));
                     System.out.println(vec.size());
                    
                     }
                    
                     public int decide(LoggingEvent event) {
                    
                     for(int i=0;i<vec.size();i++){
                    
                     if((((String)event.getMessage()).startsWith(vec.get(i).getDomainId())))
                     {
                     try{
                     appender=new FileAppender(layout,"C:\\rev2\\logs\\"+vec.get(i).getDomainName()+".log",false);
                    
                     }catch(IOException e){e.printStackTrace();
                     }
                     appender.doAppend(event);
                    
                     }
                     }
                    
                    
                    
                     return Filter.ACCEPT;
                     }
                    
                    }
                    

                    And this is one of my filtered file

                    2009-02-09 14:37:44,296 INFO [com.propco.tools.mergemanager.profiles.Fish4MergeHelper] - 233divdivdivdivdivdivdi------------vdivdivdivdivdivdiv
                    2009-02-09 14:37:44,296 INFO [com.propco.tools.mergemanager.profiles.Fish4MergeHelper] - 233divdivdivdivdivdivdi------------vdivdivdivdivdivdiv
                    2009-02-09 14:37:44,312 INFO [com.propco.tools.mergemanager.profiles.Fish4MergeHelper] - 238FISH4-ENTERPRISE on 2009/02/09-02:37 Staring the feed file creation div for domain: -enterprise
                    2009-02-09 14:37:44,312 INFO [com.propco.tools.mergemanager.profiles.Fish4MergeHelper] - 238FISH4-ENTERPRISE on 2009/02/09-02:37 Staring the feed file creation div for domain: -enterprise
                    2009-02-09 14:37:44,343 ERROR [STDERR] - java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?other?) TOWN, ifnull(prop.p_addr5, ?No Subtown?) SUBTOWN, ifnull(prop.postcode,' at line 3
                    2009-02-09 14:37:44,343 ERROR [STDERR] - at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926)
                    2009-02-09 14:37:44,343 ERROR [STDERR] - at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
                    2009-02-09 14:37:44,343 ERROR [STDERR] - at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
                    2009-02-09 14:37:44,343 ERROR [STDERR] - at com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
                    2009-02-09 14:37:44,343 ERROR [STDERR] - at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
                    2009-02-09 14:37:44,343 ERROR [STDERR] - at com.mysql.jdbc.Statement.executeQuery(Statement.java:822)
                    2009-02-09 14:37:44,343 ERROR [STDERR] - at org.jboss.resource.adapter.jdbc.WrappedStatement.executeQuery(WrappedStatement.java:171)
                    2009-02-09 14:37:44,343 ERROR [STDERR] - at com.propco.dao.SQLQueries.selectQueryThrows(SQLQueries.java:330)
                    2009-02-09 14:37:44,343 ERROR [STDERR] - at com.propco.dao.SQLQueries.selectQuery(SQLQueries.java:469)
                    2009-02-09 14:37:44,343 ERROR [STDERR] - at com.propco.tools.mergemanager.profiles.Fish4MergeHelper.<init>(Fish4MergeHelper.java:164)
                    2009-02-09 14:37:44,343 ERROR [STDERR] - at com.propco.tools.mergemanager.DeligateMergerTasks.<init>(DeligateMergerTasks.java:79)
                    2009-02-09 14:37:44,343 ERROR [STDERR] - at com.propco.tools.mergemanager.MergeManagerDAO$1.run(MergeManagerDAO.java:172)
                    2009-02-09 14:37:44,343 INFO [com.propco.tools.mergemanager.profiles.Fish4MergeHelper] - 235FISH4-ENTERPRISE on 2009/02/09-02:37 Creating entries for the Object
                    2009-02-09 14:37:44,343 INFO [com.propco.tools.mergemanager.profiles.Fish4MergeHelper] - 235FISH4-ENTERPRISE on 2009/02/09-02:37 Creating entries for the Object
                    2009-02-09 14:37:44,375 ERROR [STDERR] - Exception in thread "Thread-12"
                    2009-02-09 14:37:44,375 ERROR [STDERR] - java.lang.NullPointerException
                    2009-02-09 14:37:44,375 ERROR [STDERR] - at com.propco.tools.mergemanager.profiles.Fish4MergeHelper.createObject(Fish4MergeHelper.java:295)
                    2009-02-09 14:37:44,375 ERROR [STDERR] - at com.propco.tools.mergemanager.profiles.Fish4MergeHelper.<init>(Fish4MergeHelper.java:170)
                    2009-02-09 14:37:44,375 ERROR [STDERR] - at com.propco.tools.mergemanager.DeligateMergerTasks.<init>(DeligateMergerTasks.java:79)
                    2009-02-09 14:37:44,375 ERROR [STDERR] - at com.propco.tools.mergemanager.MergeManagerDAO$1.run(MergeManagerDAO.java:172)
                    
                    






                    Thanks And Regards
                    Divya Garg

                    • 7. Re: JBoss Consol
                      jaikiran pai Master

                       

                      Now my problem is it is filtering the log statements in coding but not sysouts.


                      You cannot use a log4j filter for filtering System.out.println messages. The System.out.print* methods are not part of log4j API. You should be changing the System.out.print* messages in your code to log messages using the log4j API.



                      • 8. Re: JBoss Consol
                        jaikiran pai Master

                         

                        "jaikiran" wrote:
                        You should be changing the System.out.print* messages in your code to log messages using the log4j API.



                        Same as what Peter suggested here http://www.jboss.com/index.html?module=bb&op=viewtopic&t=149952#4207761



                        • 9. Re: JBoss Consol
                          div garg Newbie

                          Thanks sir, now i am doing the same. I am wrinting seperate log statements
                          where there is sysout statements. But sir are there methods in log4j api which converts sysouts to log message.

                          Thanks
                          Divya Garg

                          • 10. Re: JBoss Consol
                            div garg Newbie

                            Hi


                            Now i am facing a new problem. As the server configures my custom log4j.xml file it intialize the filter properly.Call decide() but after that server halts . No message comes on consol. It stops instantly.What may be the reason.Please help me.

                            Thanks and Regards
                            Divya Garg

                            • 11. Re: JBoss Consol
                              div garg Newbie

                              It is the output of server.

                              2009-02-09 17:13:09,734 DEBUG [org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread] Notified that enabled: true
                              2009-02-09 17:13:09,734 DEBUG [org.jboss.deployment.scanner.URLDeploymentScanner] Started jboss.deployment:type=DeploymentScanner,flavor=URL
                              2009-02-09 17:13:09,734 DEBUG [org.jboss.system.ServiceController] Starting dependent components for: jboss.deployment:type=DeploymentScanner,flavor=URL dependent components: []
                              2009-02-09 17:13:09,875 DEBUG [org.jboss.deployment.MainDeployer] End deployment start on package: jboss-service.xml
                              2009-02-09 17:13:09,875 DEBUG [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/jboss1/server/default/conf/jboss-service.xml
                              2009-02-09 17:13:09,875 DEBUG [org.jboss.web.tomcat.service.JBossWeb] Saw org.jboss.system.server.started notification, starting connectors
                              2009-02-09 17:13:09,890 INFO [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
                              2009-02-09 17:13:09,921 INFO [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
                              2009-02-09 17:13:09,953 INFO [org.jboss.system.server.Server] JBoss (MX MicroKernel) [4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)] Started in 54s:63ms
                              2009-02-09 17:13:09,953 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] Periodic recovery - first pass <Mon, 9 Feb 2009 17:13:09>
                              2009-02-09 17:13:09,953 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] StatusModule: first pass
                              2009-02-09 17:13:09,953 DEBUG [com.arjuna.ats.txoj.logging.txojLoggerI18N] [com.arjuna.ats.internal.txoj.recovery.TORecoveryModule_3] - TORecoveryModule - first pass
                              2009-02-09 17:13:09,953 DEBUG [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.recovery.info.firstpass] Local XARecoveryModule - first pass
                              2009-02-09 17:13:19,968 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] Periodic recovery - second pass <Mon, 9 Feb 2009 17:13:19>
                              2009-02-09 17:13:19,968 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] AtomicActionRecoveryModule: Second pass
                              2009-02-09 17:13:19,968 DEBUG [com.arjuna.ats.txoj.logging.txojLoggerI18N] [com.arjuna.ats.internal.txoj.recovery.TORecoveryModule_6] - TORecoveryModule - second pass
                              2009-02-09 17:13:19,968 DEBUG [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.recovery.info.secondpass] Local XARecoveryModule - second pass
                              2009-02-09 17:13:43,265 DEBUG [org.jboss.remoting.transport.socket.ClientSocketWrapper] reset timeout: 60000
                              2009-02-09 17:13:43,328 INFO [STDOUT] Propco EJB Created
                              2009-02-09 17:13:43,937 INFO [STDOUT] jar:file:/C:/jboss1/server/default/tmp/deploy/tmp42069propcooffice-ejb.jar!/djboss-log4j.xml <<<<<<<<<<<<urll>>>>>>>>
                              2009-02-09 17:13:43,953 INFO [STDOUT] hi123
                              2009-02-09 17:13:43,953 INFO [STDOUT] getting domains for 192.168.5.78
                              2009-02-09 17:13:43,984 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: registering pool with interval 900000 old interval: 9223372036854775807
                              2009-02-09 17:13:43,984 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: about to notify thread: old next: 1234180273984, new next: 1234180273984
                              2009-02-09 17:13:45,328 INFO [STDOUT] div4
                              2009-02-09 17:13:45,328 INFO [STDOUT] div4
                              2009-02-09 17:13:45,328 INFO [STDOUT] Client monika (192.168.5.78) matched with clientid local
                              2009-02-09 17:13:45,328 INFO [STDOUT] JNDI Lookup=mysql-propcosystem
                              2009-02-09 17:13:45,328 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: registering pool with interval 900000 old interval: 450000
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] Client m (192.168.5.78) matched with clientid local
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] Client sans (192.168.5.78) matched with clientid local
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] Client Training1 (192.168.5.78) matched with clientid local
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] Client User (192.168.5.78) matched with clientid local
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] div4
                              2009-02-09 17:13:47,234 INFO [STDOUT] Client Divya (192.168.5.78) matched with clientid newtraining
                              2009-02-09 17:13:47,234 INFO [STDOUT] JNDI Lookup=mysql-propcosystem-newtraining
                              2009-02-09 17:13:47,234 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: registering pool with interval 900000 old interval: 450000
                              2009-02-09 17:13:49,296 INFO [STDOUT] div4
                              2009-02-09 17:13:49,296 INFO [STDOUT] div4
                              2009-02-09 17:13:49,296 INFO [STDOUT] div4
                              2009-02-09 17:13:49,296 INFO [STDOUT] div4
                              2009-02-09 17:13:49,296 INFO [STDOUT] div4
                              2009-02-09 17:13:49,296 INFO [STDOUT] div4
                              2009-02-09 17:13:49,296 INFO [STDOUT] 4
                              this is vertor size()
                              


                              After this server is halted. Nothing is happening after that in the server.

                              Thanks
                              Divya Garg