[jboss-user] [Management, JMX/JBoss] - Re: JBoss Consol
div_gcet1
do-not-reply at jboss.com
Mon Feb 9 04:13:14 EST 2009
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
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4208094#4208094
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4208094
More information about the jboss-user
mailing list