You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Rally, Varun" <va...@fiserv.com> on 2008/07/03 18:12:05 UTC
Question for CustomSQLDBReceiver
Hello All,
I am new to Chainsaw and want to use CustomSQLDBReceiver. Though I have
got an idea of what it is, I am not able to get it running. Please
provide me an internet link or URL that explains the steps to use a
CustomSQLDBReceiver.
Thanks in anticipation.
Regards,
Varun
RE: Question for CustomSQLDBReceiver
Posted by "Rally, Varun" <va...@fiserv.com>.
Thanks a ton Scott, it worked. The problem was that few columns were
missing in the SQL statement, everything else was fine.
Regards,
Varun Rally
---------------------------------------------------
Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301
Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800
VOIP - 434-509-0698 Extn. 121
US Phone- 001-303-293-2223 Extn. 22814
-----Original Message-----
From: Scott Deboy [mailto:sdeboy@comotivsystems.com]
Sent: Thursday, July 03, 2008 2:45 PM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
The receiver needs all of the columns to be in the result set that it's
creating events from. You DO NOT need to have all of the columns in
your schema - you just need to make sure the resultset being built
contains the columns.
You do this by using aliases to rename or add missing columns, and
specifying default values if the column is missing
Examples:
If you have a column named THREAD, just include THREAD as one of the
columns being selected
if you don't have column representing the THREAD information in your
table, use:
"" as THREAD
If you have a column representing thread information, but isn't named
THREAD, use:
myThreadColumnName as THREAD
Hope that clarifies.
Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Telephone: 503.224.7496
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Rally, Varun [mailto:varun.rally@fiserv.com]
Sent: Thu 7/3/2008 1:09 PM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
Hello,
I believe I am doing all of the steps mentioned below. I think the issue
is with the configuration file where I have the SQL.
In CustomSQLDBReceiver, there is an example query....
select logger as LOGGER, timestamp as TIMESTAMP, level as LEVEL, thread
as THREAD, message as MESSAGE, ndc as NDC, mdc as MDC, class as CLASS,
method as METHOD, file as FILE, line as LINE,
concat("{{application,databaselogs,hostname,mymachine, log4jid,",
COUNTER,"}}") as PROPERTIES, "" as THROWABLE from logtable
I have 1 question in the above statement.
1) Do I need to have all the columns as part of table? Right now my
table structure is not having following columns
THREAD,NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE (If these columns are
required, what should be their respective data types).
Regards,
Varun Rally
---------------------------------------------------
Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301
Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800
VOIP - 434-509-0698 Extn. 121
US Phone- 001-303-293-2223 Extn. 22814
-----Original Message-----
From: Scott Deboy [mailto:sdeboy@comotivsystems.com]
Sent: Thursday, July 03, 2008 1:51 PM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
How to use CustomSQLDBReceiver:
1. create a $userhome/.chainsaw/plugins folder
2. copy your jdbc driver to the plugins folder
3. the Chainsaw downloads page links to an 'inportant distribution
notes' link for more info about extended features - go there and follow
the instructions for what you're trying to do (db extensions)
4. create a chainsaw xml config file containing a customsqldbreceiver
section
4a. make sure to follow the directions in the class javadoc for the
receiver for setting up the 'sql' param (read: all fields must be
aliased!!)
5. change Chainsaw's 'automatic configuration url' to the URL of the
chainsaw xml config file (view-show application wide preferences menu)
7. you may need to check the 'ok to remove security manager' checkbox as
well (on the same prefs screen)
8. restart Chainsaw
You should have a receiver defined in the receivers panel. If you
don't, you haven't got the URL entered correctly in the application-wide
prefs screen, or the chainsaw XML config isn't defining the receiver
configuration correctly (see an example of a receiver config on the
Welcome tab's 'view example receiver configuration' button). If you
can't figure this out, turn on your java console, pre-configuration
Chainsaw logging goes there.
If you don't get a new tab containing your db's events, examine
Chainsaw's own logging in the chainsaw-log tab - it should explain what
the problem is.
If you still have problems, feel free to email the list.
Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Telephone: 503.224.7496
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Rally, Varun [mailto:varun.rally@fiserv.com]
Sent: Thu 7/3/2008 12:44 PM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
I created a table with the following statement.
1) CREATE TABLE `userdb`.`sys_log` (
`log_id` int(10) unsigned NOT NULL auto_increment,
`log_date` timestamp NOT NULL default CURRENT_TIMESTAMP,
`sys_name` varchar(45) NOT NULL,
`machine_name` varchar(45) NOT NULL,
`class_name` varchar(45) NOT NULL,
`priority` varchar(45) NOT NULL,
`message` varchar(45) default NULL,
`extended_message` varchar(45) default NULL,
`user_id` int(10) unsigned NOT NULL,
`method_name` varchar(45) NOT NULL,
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
My config file is like this...
2) <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
<appender name="A2" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.SimpleLayout"/>
</appender>
<plugin name="CustomDBReceiver"
class="org.apache.log4j.db.CustomSQLDBReceiver">
<connectionSource
class="org.apache.log4j.db.DriverManagerConnectionSource">
<param name="password" value="admin"/>
<param name="user" value="root"/>
<param name="driverClass" value="org.gjt.mm.mysql.Driver"/>
<param name="url" value="jdbc:mysql://127.0.0.1/user_db"/>
</connectionSource>
<param name="refreshMillis" value="5000"/>
<param name="sql" value='select logger as LOGGER, log_date as
TIMESTAMP, priority as LEVEL, message as MESSAGE, class_name as CLASS,
method_name as METHOD,
concat("{{application,databaselogs,hostname,mymachine,log4jid,",
COUNTER, "}}") as PROPERTIES, "" as EXCEPTION from sys_log'/>
THREAD, NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE
<param name="IDField" value="log_id"/>
</plugin>
<root>
<level value="debug"/>
</root>
</log4j:configuration>
I also setup automatic configuration script to point to my config file
in chainsaw. But when I open chainsaw, nothing happens. I have also put
the MySQL driver .jar file in .chainsaw/plugins directory.
Please let me know what I am missing.
Regards,
Varun Rally
---------------------------------------------------
Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301
Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800
VOIP - 434-509-0698 Extn. 121
US Phone- 001-303-293-2223 Extn. 22814
-----Original Message-----
From: Scott Deboy [mailto:sdeboy@comotivsystems.com]
Sent: Thursday, July 03, 2008 10:29 AM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/
log4j/db/CustomSQLDBReceiver.html
Add your jdbc jar to the $userhome/.chainsaw/plugins folder and update
your chainsaw xml config file to use the receiver (see the Welcome tab -
there's a 'view example receiver configuration' button on that tab which
contains an example configuration file.
The receiver essentially requires you to define aliases from your
columns to fixed columns the receiver is going to use to run the query.
It also supports an IDField param, which is assumed to be an
auto-incrementing int, which will allow you to 'tail' the events from
the database when running the query multiple times (if the refreshMillis
param is defined).
Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Telephone: 503.224.7496
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Rally, Varun [mailto:varun.rally@fiserv.com]
Sent: Thu 7/3/2008 9:12 AM
To: log4j-user@logging.apache.org
Subject: Question for CustomSQLDBReceiver
Hello All,
I am new to Chainsaw and want to use CustomSQLDBReceiver. Though I have
got an idea of what it is, I am not able to get it running. Please
provide me an internet link or URL that explains the steps to use a
CustomSQLDBReceiver.
Thanks in anticipation.
Regards,
Varun
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: Question for CustomSQLDBReceiver
Posted by Scott Deboy <sd...@comotivsystems.com>.
The receiver needs all of the columns to be in the result set that it's creating events from. You DO NOT need to have all of the columns in your schema - you just need to make sure the resultset being built contains the columns.
You do this by using aliases to rename or add missing columns, and specifying default values if the column is missing
Examples:
If you have a column named THREAD, just include THREAD as one of the columns being selected
if you don't have column representing the THREAD information in your table, use:
"" as THREAD
If you have a column representing thread information, but isn't named THREAD, use:
myThreadColumnName as THREAD
Hope that clarifies.
Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Telephone: 503.224.7496
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Rally, Varun [mailto:varun.rally@fiserv.com]
Sent: Thu 7/3/2008 1:09 PM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
Hello,
I believe I am doing all of the steps mentioned below. I think the issue
is with the configuration file where I have the SQL.
In CustomSQLDBReceiver, there is an example query....
select logger as LOGGER, timestamp as TIMESTAMP, level as LEVEL, thread
as THREAD, message as MESSAGE, ndc as NDC, mdc as MDC, class as CLASS,
method as METHOD, file as FILE, line as LINE,
concat("{{application,databaselogs,hostname,mymachine, log4jid,",
COUNTER,"}}") as PROPERTIES, "" as THROWABLE from logtable
I have 1 question in the above statement.
1) Do I need to have all the columns as part of table? Right now my
table structure is not having following columns
THREAD,NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE (If these columns are
required, what should be their respective data types).
Regards,
Varun Rally
---------------------------------------------------
Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301
Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800
VOIP - 434-509-0698 Extn. 121
US Phone- 001-303-293-2223 Extn. 22814
-----Original Message-----
From: Scott Deboy [mailto:sdeboy@comotivsystems.com]
Sent: Thursday, July 03, 2008 1:51 PM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
How to use CustomSQLDBReceiver:
1. create a $userhome/.chainsaw/plugins folder
2. copy your jdbc driver to the plugins folder
3. the Chainsaw downloads page links to an 'inportant distribution
notes' link for more info about extended features - go there and follow
the instructions for what you're trying to do (db extensions)
4. create a chainsaw xml config file containing a customsqldbreceiver
section
4a. make sure to follow the directions in the class javadoc for the
receiver for setting up the 'sql' param (read: all fields must be
aliased!!)
5. change Chainsaw's 'automatic configuration url' to the URL of the
chainsaw xml config file (view-show application wide preferences menu)
7. you may need to check the 'ok to remove security manager' checkbox as
well (on the same prefs screen)
8. restart Chainsaw
You should have a receiver defined in the receivers panel. If you
don't, you haven't got the URL entered correctly in the application-wide
prefs screen, or the chainsaw XML config isn't defining the receiver
configuration correctly (see an example of a receiver config on the
Welcome tab's 'view example receiver configuration' button). If you
can't figure this out, turn on your java console, pre-configuration
Chainsaw logging goes there.
If you don't get a new tab containing your db's events, examine
Chainsaw's own logging in the chainsaw-log tab - it should explain what
the problem is.
If you still have problems, feel free to email the list.
Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Telephone: 503.224.7496
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Rally, Varun [mailto:varun.rally@fiserv.com]
Sent: Thu 7/3/2008 12:44 PM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
I created a table with the following statement.
1) CREATE TABLE `userdb`.`sys_log` (
`log_id` int(10) unsigned NOT NULL auto_increment,
`log_date` timestamp NOT NULL default CURRENT_TIMESTAMP,
`sys_name` varchar(45) NOT NULL,
`machine_name` varchar(45) NOT NULL,
`class_name` varchar(45) NOT NULL,
`priority` varchar(45) NOT NULL,
`message` varchar(45) default NULL,
`extended_message` varchar(45) default NULL,
`user_id` int(10) unsigned NOT NULL,
`method_name` varchar(45) NOT NULL,
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
My config file is like this...
2) <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
<appender name="A2" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.SimpleLayout"/>
</appender>
<plugin name="CustomDBReceiver"
class="org.apache.log4j.db.CustomSQLDBReceiver">
<connectionSource
class="org.apache.log4j.db.DriverManagerConnectionSource">
<param name="password" value="admin"/>
<param name="user" value="root"/>
<param name="driverClass" value="org.gjt.mm.mysql.Driver"/>
<param name="url" value="jdbc:mysql://127.0.0.1/user_db"/>
</connectionSource>
<param name="refreshMillis" value="5000"/>
<param name="sql" value='select logger as LOGGER, log_date as
TIMESTAMP, priority as LEVEL, message as MESSAGE, class_name as CLASS,
method_name as METHOD,
concat("{{application,databaselogs,hostname,mymachine,log4jid,",
COUNTER, "}}") as PROPERTIES, "" as EXCEPTION from sys_log'/>
THREAD, NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE
<param name="IDField" value="log_id"/>
</plugin>
<root>
<level value="debug"/>
</root>
</log4j:configuration>
I also setup automatic configuration script to point to my config file
in chainsaw. But when I open chainsaw, nothing happens. I have also put
the MySQL driver .jar file in .chainsaw/plugins directory.
Please let me know what I am missing.
Regards,
Varun Rally
---------------------------------------------------
Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301
Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800
VOIP - 434-509-0698 Extn. 121
US Phone- 001-303-293-2223 Extn. 22814
-----Original Message-----
From: Scott Deboy [mailto:sdeboy@comotivsystems.com]
Sent: Thursday, July 03, 2008 10:29 AM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/
log4j/db/CustomSQLDBReceiver.html
Add your jdbc jar to the $userhome/.chainsaw/plugins folder and update
your chainsaw xml config file to use the receiver (see the Welcome tab -
there's a 'view example receiver configuration' button on that tab which
contains an example configuration file.
The receiver essentially requires you to define aliases from your
columns to fixed columns the receiver is going to use to run the query.
It also supports an IDField param, which is assumed to be an
auto-incrementing int, which will allow you to 'tail' the events from
the database when running the query multiple times (if the refreshMillis
param is defined).
Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Telephone: 503.224.7496
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Rally, Varun [mailto:varun.rally@fiserv.com]
Sent: Thu 7/3/2008 9:12 AM
To: log4j-user@logging.apache.org
Subject: Question for CustomSQLDBReceiver
Hello All,
I am new to Chainsaw and want to use CustomSQLDBReceiver. Though I have
got an idea of what it is, I am not able to get it running. Please
provide me an internet link or URL that explains the steps to use a
CustomSQLDBReceiver.
Thanks in anticipation.
Regards,
Varun
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: Question for CustomSQLDBReceiver
Posted by "Rally, Varun" <va...@fiserv.com>.
Hello,
I believe I am doing all of the steps mentioned below. I think the issue
is with the configuration file where I have the SQL.
In CustomSQLDBReceiver, there is an example query....
select logger as LOGGER, timestamp as TIMESTAMP, level as LEVEL, thread
as THREAD, message as MESSAGE, ndc as NDC, mdc as MDC, class as CLASS,
method as METHOD, file as FILE, line as LINE,
concat("{{application,databaselogs,hostname,mymachine, log4jid,",
COUNTER,"}}") as PROPERTIES, "" as THROWABLE from logtable
I have 1 question in the above statement.
1) Do I need to have all the columns as part of table? Right now my
table structure is not having following columns
THREAD,NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE (If these columns are
required, what should be their respective data types).
Regards,
Varun Rally
---------------------------------------------------
Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301
Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800
VOIP - 434-509-0698 Extn. 121
US Phone- 001-303-293-2223 Extn. 22814
-----Original Message-----
From: Scott Deboy [mailto:sdeboy@comotivsystems.com]
Sent: Thursday, July 03, 2008 1:51 PM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
How to use CustomSQLDBReceiver:
1. create a $userhome/.chainsaw/plugins folder
2. copy your jdbc driver to the plugins folder
3. the Chainsaw downloads page links to an 'inportant distribution
notes' link for more info about extended features - go there and follow
the instructions for what you're trying to do (db extensions)
4. create a chainsaw xml config file containing a customsqldbreceiver
section
4a. make sure to follow the directions in the class javadoc for the
receiver for setting up the 'sql' param (read: all fields must be
aliased!!)
5. change Chainsaw's 'automatic configuration url' to the URL of the
chainsaw xml config file (view-show application wide preferences menu)
7. you may need to check the 'ok to remove security manager' checkbox as
well (on the same prefs screen)
8. restart Chainsaw
You should have a receiver defined in the receivers panel. If you
don't, you haven't got the URL entered correctly in the application-wide
prefs screen, or the chainsaw XML config isn't defining the receiver
configuration correctly (see an example of a receiver config on the
Welcome tab's 'view example receiver configuration' button). If you
can't figure this out, turn on your java console, pre-configuration
Chainsaw logging goes there.
If you don't get a new tab containing your db's events, examine
Chainsaw's own logging in the chainsaw-log tab - it should explain what
the problem is.
If you still have problems, feel free to email the list.
Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Telephone: 503.224.7496
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Rally, Varun [mailto:varun.rally@fiserv.com]
Sent: Thu 7/3/2008 12:44 PM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
I created a table with the following statement.
1) CREATE TABLE `userdb`.`sys_log` (
`log_id` int(10) unsigned NOT NULL auto_increment,
`log_date` timestamp NOT NULL default CURRENT_TIMESTAMP,
`sys_name` varchar(45) NOT NULL,
`machine_name` varchar(45) NOT NULL,
`class_name` varchar(45) NOT NULL,
`priority` varchar(45) NOT NULL,
`message` varchar(45) default NULL,
`extended_message` varchar(45) default NULL,
`user_id` int(10) unsigned NOT NULL,
`method_name` varchar(45) NOT NULL,
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
My config file is like this...
2) <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
<appender name="A2" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.SimpleLayout"/>
</appender>
<plugin name="CustomDBReceiver"
class="org.apache.log4j.db.CustomSQLDBReceiver">
<connectionSource
class="org.apache.log4j.db.DriverManagerConnectionSource">
<param name="password" value="admin"/>
<param name="user" value="root"/>
<param name="driverClass" value="org.gjt.mm.mysql.Driver"/>
<param name="url" value="jdbc:mysql://127.0.0.1/user_db"/>
</connectionSource>
<param name="refreshMillis" value="5000"/>
<param name="sql" value='select logger as LOGGER, log_date as
TIMESTAMP, priority as LEVEL, message as MESSAGE, class_name as CLASS,
method_name as METHOD,
concat("{{application,databaselogs,hostname,mymachine,log4jid,",
COUNTER, "}}") as PROPERTIES, "" as EXCEPTION from sys_log'/>
THREAD, NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE
<param name="IDField" value="log_id"/>
</plugin>
<root>
<level value="debug"/>
</root>
</log4j:configuration>
I also setup automatic configuration script to point to my config file
in chainsaw. But when I open chainsaw, nothing happens. I have also put
the MySQL driver .jar file in .chainsaw/plugins directory.
Please let me know what I am missing.
Regards,
Varun Rally
---------------------------------------------------
Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301
Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800
VOIP - 434-509-0698 Extn. 121
US Phone- 001-303-293-2223 Extn. 22814
-----Original Message-----
From: Scott Deboy [mailto:sdeboy@comotivsystems.com]
Sent: Thursday, July 03, 2008 10:29 AM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/
log4j/db/CustomSQLDBReceiver.html
Add your jdbc jar to the $userhome/.chainsaw/plugins folder and update
your chainsaw xml config file to use the receiver (see the Welcome tab -
there's a 'view example receiver configuration' button on that tab which
contains an example configuration file.
The receiver essentially requires you to define aliases from your
columns to fixed columns the receiver is going to use to run the query.
It also supports an IDField param, which is assumed to be an
auto-incrementing int, which will allow you to 'tail' the events from
the database when running the query multiple times (if the refreshMillis
param is defined).
Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Telephone: 503.224.7496
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Rally, Varun [mailto:varun.rally@fiserv.com]
Sent: Thu 7/3/2008 9:12 AM
To: log4j-user@logging.apache.org
Subject: Question for CustomSQLDBReceiver
Hello All,
I am new to Chainsaw and want to use CustomSQLDBReceiver. Though I have
got an idea of what it is, I am not able to get it running. Please
provide me an internet link or URL that explains the steps to use a
CustomSQLDBReceiver.
Thanks in anticipation.
Regards,
Varun
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: Question for CustomSQLDBReceiver
Posted by Scott Deboy <sd...@comotivsystems.com>.
How to use CustomSQLDBReceiver:
1. create a $userhome/.chainsaw/plugins folder
2. copy your jdbc driver to the plugins folder
3. the Chainsaw downloads page links to an 'inportant distribution notes' link for more info about extended features - go there and follow the instructions for what you're trying to do (db extensions)
4. create a chainsaw xml config file containing a customsqldbreceiver section
4a. make sure to follow the directions in the class javadoc for the receiver for setting up the 'sql' param (read: all fields must be aliased!!)
5. change Chainsaw's 'automatic configuration url' to the URL of the chainsaw xml config file (view-show application wide preferences menu)
7. you may need to check the 'ok to remove security manager' checkbox as well (on the same prefs screen)
8. restart Chainsaw
You should have a receiver defined in the receivers panel. If you don't, you haven't got the URL entered correctly in the application-wide prefs screen, or the chainsaw XML config isn't defining the receiver configuration correctly (see an example of a receiver config on the Welcome tab's 'view example receiver configuration' button). If you can't figure this out, turn on your java console, pre-configuration Chainsaw logging goes there.
If you don't get a new tab containing your db's events, examine Chainsaw's own logging in the chainsaw-log tab - it should explain what the problem is.
If you still have problems, feel free to email the list.
Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Telephone: 503.224.7496
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Rally, Varun [mailto:varun.rally@fiserv.com]
Sent: Thu 7/3/2008 12:44 PM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
I created a table with the following statement.
1) CREATE TABLE `userdb`.`sys_log` (
`log_id` int(10) unsigned NOT NULL auto_increment,
`log_date` timestamp NOT NULL default CURRENT_TIMESTAMP,
`sys_name` varchar(45) NOT NULL,
`machine_name` varchar(45) NOT NULL,
`class_name` varchar(45) NOT NULL,
`priority` varchar(45) NOT NULL,
`message` varchar(45) default NULL,
`extended_message` varchar(45) default NULL,
`user_id` int(10) unsigned NOT NULL,
`method_name` varchar(45) NOT NULL,
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
My config file is like this...
2) <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
<appender name="A2" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.SimpleLayout"/>
</appender>
<plugin name="CustomDBReceiver"
class="org.apache.log4j.db.CustomSQLDBReceiver">
<connectionSource
class="org.apache.log4j.db.DriverManagerConnectionSource">
<param name="password" value="admin"/>
<param name="user" value="root"/>
<param name="driverClass" value="org.gjt.mm.mysql.Driver"/>
<param name="url" value="jdbc:mysql://127.0.0.1/user_db"/>
</connectionSource>
<param name="refreshMillis" value="5000"/>
<param name="sql" value='select logger as LOGGER, log_date as
TIMESTAMP, priority as LEVEL, message as MESSAGE, class_name as CLASS,
method_name as METHOD,
concat("{{application,databaselogs,hostname,mymachine,log4jid,",
COUNTER, "}}") as PROPERTIES, "" as EXCEPTION from sys_log'/>
THREAD, NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE
<param name="IDField" value="log_id"/>
</plugin>
<root>
<level value="debug"/>
</root>
</log4j:configuration>
I also setup automatic configuration script to point to my config file
in chainsaw. But when I open chainsaw, nothing happens. I have also put
the MySQL driver .jar file in .chainsaw/plugins directory.
Please let me know what I am missing.
Regards,
Varun Rally
---------------------------------------------------
Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301
Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800
VOIP - 434-509-0698 Extn. 121
US Phone- 001-303-293-2223 Extn. 22814
-----Original Message-----
From: Scott Deboy [mailto:sdeboy@comotivsystems.com]
Sent: Thursday, July 03, 2008 10:29 AM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/
log4j/db/CustomSQLDBReceiver.html
Add your jdbc jar to the $userhome/.chainsaw/plugins folder and update
your chainsaw xml config file to use the receiver (see the Welcome tab -
there's a 'view example receiver configuration' button on that tab which
contains an example configuration file.
The receiver essentially requires you to define aliases from your
columns to fixed columns the receiver is going to use to run the query.
It also supports an IDField param, which is assumed to be an
auto-incrementing int, which will allow you to 'tail' the events from
the database when running the query multiple times (if the refreshMillis
param is defined).
Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Telephone: 503.224.7496
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Rally, Varun [mailto:varun.rally@fiserv.com]
Sent: Thu 7/3/2008 9:12 AM
To: log4j-user@logging.apache.org
Subject: Question for CustomSQLDBReceiver
Hello All,
I am new to Chainsaw and want to use CustomSQLDBReceiver. Though I have
got an idea of what it is, I am not able to get it running. Please
provide me an internet link or URL that explains the steps to use a
CustomSQLDBReceiver.
Thanks in anticipation.
Regards,
Varun
RE: Question for CustomSQLDBReceiver
Posted by "Rally, Varun" <va...@fiserv.com>.
I created a table with the following statement.
1) CREATE TABLE `userdb`.`sys_log` (
`log_id` int(10) unsigned NOT NULL auto_increment,
`log_date` timestamp NOT NULL default CURRENT_TIMESTAMP,
`sys_name` varchar(45) NOT NULL,
`machine_name` varchar(45) NOT NULL,
`class_name` varchar(45) NOT NULL,
`priority` varchar(45) NOT NULL,
`message` varchar(45) default NULL,
`extended_message` varchar(45) default NULL,
`user_id` int(10) unsigned NOT NULL,
`method_name` varchar(45) NOT NULL,
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
My config file is like this...
2) <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
<appender name="A2" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.SimpleLayout"/>
</appender>
<plugin name="CustomDBReceiver"
class="org.apache.log4j.db.CustomSQLDBReceiver">
<connectionSource
class="org.apache.log4j.db.DriverManagerConnectionSource">
<param name="password" value="admin"/>
<param name="user" value="root"/>
<param name="driverClass" value="org.gjt.mm.mysql.Driver"/>
<param name="url" value="jdbc:mysql://127.0.0.1/user_db"/>
</connectionSource>
<param name="refreshMillis" value="5000"/>
<param name="sql" value='select logger as LOGGER, log_date as
TIMESTAMP, priority as LEVEL, message as MESSAGE, class_name as CLASS,
method_name as METHOD,
concat("{{application,databaselogs,hostname,mymachine,log4jid,",
COUNTER, "}}") as PROPERTIES, "" as EXCEPTION from sys_log'/>
THREAD, NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE
<param name="IDField" value="log_id"/>
</plugin>
<root>
<level value="debug"/>
</root>
</log4j:configuration>
I also setup automatic configuration script to point to my config file
in chainsaw. But when I open chainsaw, nothing happens. I have also put
the MySQL driver .jar file in .chainsaw/plugins directory.
Please let me know what I am missing.
Regards,
Varun Rally
---------------------------------------------------
Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301
Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800
VOIP - 434-509-0698 Extn. 121
US Phone- 001-303-293-2223 Extn. 22814
-----Original Message-----
From: Scott Deboy [mailto:sdeboy@comotivsystems.com]
Sent: Thursday, July 03, 2008 10:29 AM
To: Log4J Users List
Subject: RE: Question for CustomSQLDBReceiver
http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/
log4j/db/CustomSQLDBReceiver.html
Add your jdbc jar to the $userhome/.chainsaw/plugins folder and update
your chainsaw xml config file to use the receiver (see the Welcome tab -
there's a 'view example receiver configuration' button on that tab which
contains an example configuration file.
The receiver essentially requires you to define aliases from your
columns to fixed columns the receiver is going to use to run the query.
It also supports an IDField param, which is assumed to be an
auto-incrementing int, which will allow you to 'tail' the events from
the database when running the query multiple times (if the refreshMillis
param is defined).
Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Telephone: 503.224.7496
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Rally, Varun [mailto:varun.rally@fiserv.com]
Sent: Thu 7/3/2008 9:12 AM
To: log4j-user@logging.apache.org
Subject: Question for CustomSQLDBReceiver
Hello All,
I am new to Chainsaw and want to use CustomSQLDBReceiver. Though I have
got an idea of what it is, I am not able to get it running. Please
provide me an internet link or URL that explains the steps to use a
CustomSQLDBReceiver.
Thanks in anticipation.
Regards,
Varun
RE: Question for CustomSQLDBReceiver
Posted by Scott Deboy <sd...@comotivsystems.com>.
http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/log4j/db/CustomSQLDBReceiver.html
Add your jdbc jar to the $userhome/.chainsaw/plugins folder and update your chainsaw xml config file to use the receiver (see the Welcome tab - there's a 'view example receiver configuration' button on that tab which contains an example configuration file.
The receiver essentially requires you to define aliases from your columns to fixed columns the receiver is going to use to run the query. It also supports an IDField param, which is assumed to be an auto-incrementing int, which will allow you to 'tail' the events from the database when running the query multiple times (if the refreshMillis param is defined).
Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Telephone: 503.224.7496
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Rally, Varun [mailto:varun.rally@fiserv.com]
Sent: Thu 7/3/2008 9:12 AM
To: log4j-user@logging.apache.org
Subject: Question for CustomSQLDBReceiver
Hello All,
I am new to Chainsaw and want to use CustomSQLDBReceiver. Though I have
got an idea of what it is, I am not able to get it running. Please
provide me an internet link or URL that explains the steps to use a
CustomSQLDBReceiver.
Thanks in anticipation.
Regards,
Varun