You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Tim Murison <tm...@primus.ca> on 2005/02/15 05:11:03 UTC

Odd problem

Hi,

I'm hoping someone might be able to shed some light on this...

I have a function that executes a DB query and returns a vector<string>
of the results. I have just started to add logging to my program, so
just before returning the vector, I issue a logging statement:

LOG4CXX_INFO(logger, "Done read query");

Here the weird bit. If I comment out the logging statement, the vector
elements are something like:
	[1, OBJECT, 2]
With the logging statement the elements are:
	[1, Done read query, 2]

I am using log4cxx 0.9.7. I have tried compiling CVS HEAD, but it fails
with some scary messages (both using autogen and ant).

Any ideas?

Cheers,

-Tim


Re: Odd problem

Posted by Curt Arnold <ca...@apache.org>.
On Feb 15, 2005, at 10:11 PM, Tim Murison wrote:
>>
>> Strange indeed.  I don't see anything obvious in the header expansion
>> that could explain that.  I'm surprised that any overflow would leave
>> things in such a nice condition.
>
> I have tried again with CVS HEAD, no change. I'm thinking this must 
> mean
> that its my fault... where oh where to begin!
>

Try changing the vector to vector<const std::string> and see if you get 
any compiler error.  Try running the code through the preprocessor and 
see what LOG4CXX_DEBUG expands to, look for any variable name overlap 
between the expanded code and the surrounding code.  Copy the expanded 
form into the source code and single step to see when the vector gets 
modified.  Try to reproduce the problem in very small application and 
post it as a bug.

>
> You are quite right... log4cxx compiled with just the one warning.
> However, the unit-test target fails. If you are interested, I can post
> the logs.
>

Please.


Re: Odd problem

Posted by Tim Murison <tm...@primus.ca>.
> > Hi,
> >
> > I'm hoping someone might be able to shed some light on this...
> >
> > I have a function that executes a DB query and returns a vector<string>
> > of the results. I have just started to add logging to my program, so
> > just before returning the vector, I issue a logging statement:
> >
> > LOG4CXX_INFO(logger, "Done read query");
> >
> > Here the weird bit. If I comment out the logging statement, the vector
> > elements are something like:
> > 	[1, OBJECT, 2]
> > With the logging statement the elements are:
> > 	[1, Done read query, 2]
> >
> 
> Strange indeed.  I don't see anything obvious in the header expansion 
> that could explain that.  I'm surprised that any overflow would leave 
> things in such a nice condition.

I have tried again with CVS HEAD, no change. I'm thinking this must mean
that its my fault... where oh where to begin!

> > I am using log4cxx 0.9.7. I have tried compiling CVS HEAD, but it fails
> > with some scary messages (both using autogen and ant).
> >
> 
> There will be one message about assigning a pointer to an integer of a 
> different size that should be harmless.  That occurs in the code that 
> converts a thread* to an hex number.  Since there isn't a handy 
> portable type for "integer the same size as a pointer", the code 
> assigns a pointer to a 64-bit integer resulting in that message on 
> 32-bit platforms.
> 
> If you are failing to build or getting other scary messages, please 
> file a bug report (http://nagoya.apache.org/jira) and I'll try to 
> address them.  You can use a "-l logfilename" on the Ant build to log 
> the build.  Please indicate platform, compiler, et al.

You are quite right... log4cxx compiled with just the one warning.
However, the unit-test target fails. If you are interested, I can post
the logs.

> 
> 


Re: Odd problem

Posted by Curt Arnold <ca...@apache.org>.

On Feb 14, 2005, at 10:11 PM, Tim Murison wrote:

> Hi,
>
> I'm hoping someone might be able to shed some light on this...
>
> I have a function that executes a DB query and returns a vector<string>
> of the results. I have just started to add logging to my program, so
> just before returning the vector, I issue a logging statement:
>
> LOG4CXX_INFO(logger, "Done read query");
>
> Here the weird bit. If I comment out the logging statement, the vector
> elements are something like:
> 	[1, OBJECT, 2]
> With the logging statement the elements are:
> 	[1, Done read query, 2]
>

Strange indeed.  I don't see anything obvious in the header expansion 
that could explain that.  I'm surprised that any overflow would leave 
things in such a nice condition.


> I am using log4cxx 0.9.7. I have tried compiling CVS HEAD, but it fails
> with some scary messages (both using autogen and ant).
>

There will be one message about assigning a pointer to an integer of a 
different size that should be harmless.  That occurs in the code that 
converts a thread* to an hex number.  Since there isn't a handy 
portable type for "integer the same size as a pointer", the code 
assigns a pointer to a 64-bit integer resulting in that message on 
32-bit platforms.

If you are failing to build or getting other scary messages, please 
file a bug report (http://nagoya.apache.org/jira) and I'll try to 
address them.  You can use a "-l logfilename" on the Ant build to log 
the build.  Please indicate platform, compiler, et al.