You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Mayuresh Nirhali <Ma...@Sun.COM> on 2006/07/13 13:53:51 UTC

enabling tracing info while running tests

Hello,

I am trying to get tracing info for a test run in standalone manner. The 
test runs fine, but I do not see the traceFile being created.

The command I use is as below,


java -cp $CLASSPATH -Dframework=DerbyNetClient 
-DtestSpecialProps=derby.infolog.append=true^derby.drda.traceFile=./trace.out^derby.drda.traceLevel=org.apache.derby.jdbc.ClientDataSource.TRACE_PROTOCOL_FLOWS 
org.apache.derbyTesting.functionTests.harness.RunTest 
jdbcapi/parameterMapping.java

Is there anything that I am missing ??


What is the best way to generate tracing data for tests ??


TIA
Mayuresh

Re: enabling tracing info while running tests

Posted by John Embretsen <Jo...@Sun.COM>.
John Embretsen wrote:
> Myrna van Lunteren wrote:
>> -Djvmflags will do anything for NetworkServerControl, it only works
>> with the test harness
>> (org.apache.derbyTesting.functionTests.harness.RunTest or RunSuite).
> 
> That is true. 

A "not" is missing from Myrna's statement above. What I meant to say was 
that it is true that -Djvmflags will *not* have any effect on 
NetworkServerControl. (It only works with the test harness.)


-- 
John

Re: enabling tracing info while running tests

Posted by John Embretsen <Jo...@Sun.COM>.
Myrna van Lunteren wrote:
> On 7/17/06, Mayuresh Nirhali <Ma...@sun.com> wrote:
>> >>Hello,
>> >>
>> >>I am trying to get tracing info for a test run in standalone
>> >>manner. The test runs fine, but I do not see the traceFile being
>> >>created.
>> I tried following but didn't get the trace file.
>>
>> java -cp $CLASSPATH -Djvmflags=derby.drda.traceFile=trace.out
>> org.apache.derby.drda.NetworkServerControl start
>>
> 
> Oops! just my 2 cents on that one...(note that I'm not really
> following the discussion, too wrapped up at the moment with other
> tasks, sorry).
> 
> -Djvmflags will do anything for NetworkServerControl, it only works
> with the test harness
> (org.apache.derbyTesting.functionTests.harness.RunTest or RunSuite).

That is true. I also think that the "-D"-prefix has to be included for
all system properties passed to the harness as part of the jvmflags
property, e.g.:

java
-Djvmflags=-Dderby.drda.logConnections=true^-Dderby.drda.traceAll=true^-Xmx256m 

org.apache.derbyTesting.... etc.


> Apologies if I confused the issue. With NetworkServerControl you want
> to just use -Dderby.drda.traceFile=, I think, if that property is
> valid at all. 

As far as I can tell from the docs (adminguide), derby.drda.traceFile is
not a valid property on the server side (at least not documented as such).

traceFile and traceLevel are connection URL attributes to be used for
client side tracing. See
http://db.apache.org/derby/docs/dev/adminguide/cadminappsclienttracing.html. 

I was not able to see any mention of such properties on the server side.
And they had no effect when I tried them...

To enable server side tracing, I found it easiest to follow the approach
described by Knut Anders in
http://www.nabble.com/Re%3A-enabling-tracing-info-while-running-tests-p5322869.html.

Specifically, start the Network Server manually with the property
derby.drda.traceAll=true, e.g:

java -Dderby.drda.traceAll=true -jar derbyrun.jar server start

Then start the test:

java -Dverbose=true -Dframework=DerbyNetClient
org.apache.derbyTesting.functionTests.harness.RunTest
jdbcapi/parameterMapping.java

Trace files end up as Server<SESSION_NUMBER>.trace files in the
derby.system.home directory (default is the directory where you started
the server), unless you also specify the derby.drda.traceDirectory
property when starting the server.

Server properties are documented here:

http://db.apache.org/derby/docs/dev/adminguide/tadminconfigsettingnetwrokserverproperties.html

> When you run a test with RunTest, you can use -Dverbose=true
> -Dkeepfiles=true to see the actual command it is using, then look at
> the *_app.properties and *_derby.properties file within the test
> subdirectory to see the actual properties it has picked up...Then work
> your modifications from there.

I tried passing the derby.drda.traceAll property to the harness via
jvmflags, but the test hung, probably due to lack of (SecurityManager)
write permissions when writing the trace files. That might be something
to keep in mind if this path is pursued further.


-- 
John



Re: enabling tracing info while running tests

Posted by Myrna van Lunteren <m....@gmail.com>.
On 7/17/06, Mayuresh Nirhali <Ma...@sun.com> wrote:
> >>Hello,
> >>
> >>I am trying to get tracing info for a test run in standalone
> >>manner. The test runs fine, but I do not see the traceFile being
> >>created.
> I tried following but didn't get the trace file.
>
> java -cp $CLASSPATH -Djvmflags=derby.drda.traceFile=trace.out
> org.apache.derby.drda.NetworkServerControl start
>

Oops! just my 2 cents on that one...(note that I'm not really
following the discussion, too wrapped up at the moment with other
tasks, sorry).

-Djvmflags will do anything for NetworkServerControl, it only works
with the test harness
(org.apache.derbyTesting.functionTests.harness.RunTest or RunSuite).

Apologies if I confused the issue. With NetworkServerControl you want
to just use -Dderby.drda.traceFile=, I think, if that property is
valid at all. Same for derby.drda.traceDirectory, to pass it to
NetworkServerControl, don't use the test harness' jvmFlags...

When you run a test with RunTest, you can use -Dverbose=true
-Dkeepfiles=true to see the actual command it is using, then look at
the *_app.properties and *_derby.properties file within the test
subdirectory to see the actual properties it has picked up...Then work
your modifications from there.

hth
Myrna

Re: enabling tracing info while running tests

Posted by Mayuresh Nirhali <Ma...@Sun.COM>.
Knut Anders Hatlen wrote:

>Mayuresh Nirhali <Ma...@Sun.COM> writes:
>
>  
>
>>Hello,
>>
>>I am trying to get tracing info for a test run in standalone
>>manner. The test runs fine, but I do not see the traceFile being
>>created.
>>
>>The command I use is as below,
>>
>>
>>java -cp $CLASSPATH -Dframework=DerbyNetClient
>>-DtestSpecialProps=derby.infolog.append=true^derby.drda.traceFile=./trace.out^derby.drda.traceLevel=org.apache.derby.jdbc.ClientDataSource.TRACE_PROTOCOL_FLOWS
>>org.apache.derbyTesting.functionTests.harness.RunTest
>>jdbcapi/parameterMapping.java
>>
>>Is there anything that I am missing ??
>>
>>What is the best way to generate tracing data for tests ??
>>    
>>
>
>Hi Mayuresh,
>
>derby.drda.traceFile should be passed to the network server process,
>but I'm not sure whether testSpecialProps does that. By the way, I
>don't think there is a derby.drda.traceFile property, but there is a
>derby.drda.traceDirectory.
>
>What I usually do when I need server-side tracing of a test, is
>starting the network server with the required parameters before
>running the test. Since a server is already running, the test harness
>won't start a new one.
>  
>
I tried following but didn't get the trace file.

java -cp $CLASSPATH -Djvmflags=derby.drda.traceFile=trace.out 
org.apache.derby.drda.NetworkServerControl start

i also tried derby.drda.traceDirectory instead in the above command, but 
no luck.
Could you please post your command for my reference ??

any docs/twiki for more info on debugging ??

>To enable client-side tracing, you need to modify the connection
>URL. For parameterMapping.java, I think you can do that by adding
>"ij.database=jdbc:derby:wombat;create=true;traceFile=trace.out" to
>parameterMapping_app.properties.
>
>  
>
I created a new file in tests/jdbcapi directory, 
parameterMapping_derby.properties and added following 2 lines,
derby.drda.traceFile=trace.out
derby.drda.traceAll=true

and ran the test in DerbyNetClient mode (w/o starting server 
separately), the test has been running for almost 20 mins now, could it 
be this slow ??

Mayuresh


Re: enabling tracing info while running tests

Posted by Myrna van Lunteren <m....@gmail.com>.
On 7/14/06, Knut Anders Hatlen <Kn...@sun.com> wrote:
> Mayuresh Nirhali <Ma...@Sun.COM> writes:
>
> > Hello,
> >
> > I am trying to get tracing info for a test run in standalone
> > manner. The test runs fine, but I do not see the traceFile being
> > created.
> >
> > The command I use is as below,
> >
> >
> > java -cp $CLASSPATH -Dframework=DerbyNetClient
> > -DtestSpecialProps=derby.infolog.append=true^derby.drda.traceFile=./trace.out^derby.drda.traceLevel=org.apache.derby.jdbc.ClientDataSource.TRACE_PROTOCOL_FLOWS
> > org.apache.derbyTesting.functionTests.harness.RunTest
> > jdbcapi/parameterMapping.java
> >
> > Is there anything that I am missing ??
> >
> > What is the best way to generate tracing data for tests ??
>
> Hi Mayuresh,
>
> derby.drda.traceFile should be passed to the network server process,
> but I'm not sure whether testSpecialProps does that. By the way, I
> don't think there is a derby.drda.traceFile property, but there is a
> derby.drda.traceDirectory.
>
> What I usually do when I need server-side tracing of a test, is
> starting the network server with the required parameters before
> running the test. Since a server is already running, the test harness
> won't start a new one.
>
> To enable client-side tracing, you need to modify the connection
> URL. For parameterMapping.java, I think you can do that by adding
> "ij.database=jdbc:derby:wombat;create=true;traceFile=trace.out" to
> parameterMapping_app.properties.
>
> --
> Knut Anders
>
Always a good idea to try & eliminate the test harness...
I have not looked at this specific command, but with revision 420048 a
patch for jvmflags handling went in...You could try & see what happens
if you use -Djvmflags= instead of testSpecialProps. jvmflags is now a
^-separated list.

Myrna

Re: enabling tracing info while running tests

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Mayuresh Nirhali <Ma...@Sun.COM> writes:

> Hello,
>
> I am trying to get tracing info for a test run in standalone
> manner. The test runs fine, but I do not see the traceFile being
> created.
>
> The command I use is as below,
>
>
> java -cp $CLASSPATH -Dframework=DerbyNetClient
> -DtestSpecialProps=derby.infolog.append=true^derby.drda.traceFile=./trace.out^derby.drda.traceLevel=org.apache.derby.jdbc.ClientDataSource.TRACE_PROTOCOL_FLOWS
> org.apache.derbyTesting.functionTests.harness.RunTest
> jdbcapi/parameterMapping.java
>
> Is there anything that I am missing ??
>
> What is the best way to generate tracing data for tests ??

Hi Mayuresh,

derby.drda.traceFile should be passed to the network server process,
but I'm not sure whether testSpecialProps does that. By the way, I
don't think there is a derby.drda.traceFile property, but there is a
derby.drda.traceDirectory.

What I usually do when I need server-side tracing of a test, is
starting the network server with the required parameters before
running the test. Since a server is already running, the test harness
won't start a new one.

To enable client-side tracing, you need to modify the connection
URL. For parameterMapping.java, I think you can do that by adding
"ij.database=jdbc:derby:wombat;create=true;traceFile=trace.out" to
parameterMapping_app.properties.

-- 
Knut Anders