logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Oberoi" <aobe...@TechMahindra.com>
Subject RE: JDBCReceiver
Date Mon, 04 Jul 2011 13:54:09 GMT
Scott,

 

Thanks for your help. I have now configured this with My SQL however I
am not yet done. 

 

My appender defination is as below:

 

<appender name="jdbc" class="org.apache.log4j.jdbc.JDBCAppender">

        <param name="url"
value="jdbc:mysql://172.21.171.240:3306:AutomationLogs"/>

        <param name="driver" value="org.gjt.mm.mysql.Driver"/>

        <param name="user" value="root"/>

        <param name="password" value="password"/>

        <param name="sql" value="INSERT INTO LOGS (TIMESTAMP, THREAD,
CLASS, METHOD, FILE, LINE, PRIORITY, LOGGER, MESSAGE) VALUES('%d{dd MMM
yyyy HH:mm:ss}','%t', '%C', '%M', '%F', '%L', '%p', '%c{1}', '%m')"/>

        <layout class="org.apache.log4j.PatternLayout"/>

    </appender>

 

While logging I am getting warning as :

 

log4j:WARN No such property [url] in org.apache.log4j.jdbc.JDBCAppender.

and exception as below which I guess is mainly due to URL setting up; am
I doing anything wrong over here:

 

log4j:ERROR Failed to excute sql

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name
not found and no default driver specified

        at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)

        at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)

        at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3073)

        at
sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)

        at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)

        at java.sql.DriverManager.getConnection(DriverManager.java:582)

        at java.sql.DriverManager.getConnection(DriverManager.java:185)

        at
org.apache.log4j.jdbc.JDBCAppender.getConnection(JDBCAppender.java:252)

        at
org.apache.log4j.jdbc.JDBCAppender.execute(JDBCAppender.java:215)

        at
org.apache.log4j.jdbc.JDBCAppender.flushBuffer(JDBCAppender.java:290)

        at
org.apache.log4j.jdbc.JDBCAppender.append(JDBCAppender.java:186)

        at
org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)

        at
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(Ap
penderAttachableImpl.java:66)

        at org.apache.log4j.Category.callAppenders(Category.java:206)

        at org.apache.log4j.Category.forcedLog(Category.java:391)

        at org.apache.log4j.Category.info(Category.java:666)

        at
com.btw.utils.OneSeibelDriver.doLogin(OneSeibelDriver.java:71)

        at
com.btw.test.bb.l2c.wbmc.GB003_WBMC_Raise_Provide_of_Shared_Service_and_
Shared_Host_Link_with_10G_EAD.raiseWBMCProvideFromSeibel(GB003_WBMC_Rais
e_Provide_of_Shared_Service_and_Shared_Host_Link_with_10G_EAD.java:135)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)

        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:597)

        at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMet
hod.java:44)

        at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallab
le.java:15)

        at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMetho
d.java:41)

        at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod
.java:20)

        at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.jav
a:28)

        at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:
31)

        at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassR
unner.java:79)

        at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner
.java:71)

        at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner
.java:49)

        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)

        at
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)

        at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)

        at
org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)

        at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)

        at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.jav
a:28)

        at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:
31)

        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

        at
junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)

        at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTe
stRunner.java:420)

        at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUni
tTestRunner.java:911)

        at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitT
estRunner.java:768)

Regards

 

Amit Oberoi

 

-----Original Message-----
From: Scott Deboy [mailto:scott.deboy@gmail.com] 
Sent: Wednesday, June 29, 2011 12:12 AM
To: Log4J Users List
Subject: Re: JDBCReceiver

 

This should go into a Wiki, but here you go:

 

- download the latest developer snapshot from

http://people.apache.org/~sdeboy

- copy your jdbc driver into your $USERHOME/.chainsaw/plugins folder

- copy this example chainsaw config file to your machine:

http://svn.apache.org/repos/asf/logging/chainsaw/trunk/src/main/resource
s/org/apache/log4j/chainsaw/log4j-receiver-sample.xml

- delete all of the 'plugin' entries except the customDBReceiver entry

- modify that entry to match the SQL statement you need based on the
JavaDoc

for the CustomSQLDBReceiver...note the explanation of IDField, which

prevents allows you to 'tail' the events in the DB by adding a 'where'

clause using that Id field (if it is available in your table)..here's
the

JavaDoc:

http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/
log4j/db/CustomSQLDBReceiver.html

- start Chainsaw

- Load a chainsaw configuration by selecting the 'Use a chainsaw config

file' option from the 'Load events into Chainsaw' dialog

- Click 'open file' and browse to your config file you created..click

'always start Chainsaw with this configuration' if appropriate

 

Scott

 

On Tue, Jun 28, 2011 at 7:45 AM, Amit Oberoi
<aoberoi@techmahindra.com>wrote:

 

> Any suggestions ?

> 

> Regards

> 

> Amit oberoi

> 

> -----Original Message-----

> From: Amit Oberoi [mailto:aoberoi@TechMahindra.com]

> Sent: Tuesday, June 28, 2011 6:16 PM

> To: log4j-user@logging.apache.org

> Subject: JDBCReceiver

> 

> All,

> 

> 

> 

> I have on several threads on Google suggesting the availability of

> JDBCReceiver for chainsaw however I couldn't locate it anywhere.
Please

> can someone suggest me where can I find it and how can this be

> configured with Chainsaw V2.

> 

> 

> 

> Regards

> 

> 

> 

> Amit Oberoi

> 

> 

>
========================================================================

> ====================================================Disclaimer:  This

> message and the information contained herein is proprietary and

> confidential and subject to the Tech Mahindra policy statement, you
may

> review the policy at <a

>
href="http://www.techmahindra.com/Disclaimer.html">http://www.techmahind

> ra.com/Disclaimer.html</a> externally and <a

>
href="http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahind

> ra.com/Disclaimer.html</a> internally within Tech

>
Mahindra.===============================================================

> =============================================================

> 

>
========================================================================
====================================================Disclaimer:

>  This message and the information contained herein is proprietary and

> confidential and subject to the Tech Mahindra policy statement, you
may

> review the policy at <a
href="http://www.techmahindra.com/Disclaimer.html

> ">http://www.techmahindra.com/Disclaimer.html</a> externally and <a
href="

> http://tim.techmahindra.com/Disclaimer.html">

> http://tim.techmahindra.com/Disclaimer.html</a> internally within Tech

>
Mahindra.===============================================================
=============================================================

> 

> ---------------------------------------------------------------------

> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org

> For additional commands, e-mail: log4j-user-help@logging.apache.org

> 

> 


============================================================================================================================Disclaimer:
 This message and the information contained herein is proprietary and confidential and subject
to the Tech Mahindra policy statement, you may review the policy at <a href="http://www.techmahindra.com/Disclaimer.html">http://www.techmahindra.com/Disclaimer.html</a>
externally and <a href="http://tim.techmahindra.com/Disclaimer.html">http://tim.techmahindra.com/Disclaimer.html</a>
internally within Tech Mahindra.============================================================================================================================

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message