ThreadSpecificData improvement.

Curt Arnold a écrit :
>
> On Aug 13, 2004, at 9:44 AM, Christophe de VIENNE wrote:
>
>> Any idea/suggestion welcome,
>>
>>
>
> Not directly on point, but I had a couple of random, unconsidered
> thoughts related to threads that I'd like to throw out if anyone is
> going to be digging into to this.
>
> 1. Apache Portable Runtime (http://apr.apache.org) provides a C
> threading API. Thought it probably isn't desirable to require APR
> especially just for threading, it might be good to support it as a
> threading option to support rarer platforms.
The threading API of APR looks quite simple (and close to pthread), it
shouldn't be a problem to support it the day it's needed.
> 2. The CriticalSection instance in log4cxx::helpers::ObjectImpl causes
> config.h to be expanded for the abstract classes in public API.
> Isolating implementation details from the client API would require
> removing the CriticalSection from the abstract base class and
> reintroducing it in the concrete implementation classes. perhaps via
> templating and/or macros.
Another solution is to typedef the main types we use in threading,
depending on PTHREAD (not HAVE_PTHREAD), and WIN32. This will require

How to log milliseconds?

Martin Lechner <bruce_np <at> sbox.tugraz.at>
2004-08-16 17:47:24 GMT

Hello log4cxx-user,
I have a question:
How do I log milliseconds in Patternlaypout?
I tried with the %Q option as statet in the documentationlike this:
%d{%H:%M:%S-%Q}
but output schows a % sign after the seconds where the
milliseconds should be...
Anyone can help? Is it somehow possible to log microseconds?
--
--
Best regards,
Martin mailto:bruce_np <at> sbox.tugraz.at

Compiler Warnings

Sean Rohead <sean.rohead <at> nextpage.com>
2004-08-16 17:55:05 GMT

When using the log4cxx libraries in a VisualStudio project, I am getting
3 warnings in tchar.h:
include\log4cxx\helpers\tchar.h(263) : warning C4244: 'argument' :
conversion from '__w64 int' to 'std::streamoff', possible loss of data
include\log4cxx\helpers\tchar.h(264) : warning C4244: 'argument' :
conversion from '__w64 int' to 'int', possible loss of data
include\log4cxx\helpers\tchar.h(269) : warning C4244: 'argument' :
conversion from '__w64 int' to 'std::streamoff', possible loss of data
Are these warnings something I should be concerned about? Am I
including things in the wrong order or is there some other way to get
rid of these warnings?
Thanks,
Sean Rohead

RE: Compiler Warnings

Eric Rosenquist <eric <at> rosenquist.com>
2004-08-16 17:59:16 GMT

> When using the log4cxx libraries in a VisualStudio project, I
> am getting 3 warnings in tchar.h:
>
> include\log4cxx\helpers\tchar.h(263) : warning C4244: 'argument' :
> conversion from '__w64 int' to 'std::streamoff', possible loss of data
In general it means there's a chance you could truncate a value. In
practice you'd have to know if the types might actually hold 64 bit
values to know if you need to worry.
Visual Studio .NET has such warnings enabled by default. If you don't
want to see them, go to Project / Properties and turn off "Detect 64-bit
Portability Issues" in the C/C++ General settings.
Eric

Re: ThreadSpecificData improvement.

Curt Arnold <carnold <at> houston.rr.com>
2004-08-16 18:07:36 GMT

>> 2. The CriticalSection instance in log4cxx::helpers::ObjectImpl
>> causes config.h to be expanded for the abstract classes in public
>> API. Isolating implementation details from the client API would
>> require removing the CriticalSection from the abstract base class and
>> reintroducing it in the concrete implementation classes. perhaps via
>> templating and/or macros.
>
> Another solution is to typedef the main types we use in threading,
> depending on PTHREAD (not HAVE_PTHREAD), and WIN32. This will require
> the library user to add -DPTHREAD on it's compiler command line, which
> is not a problem I think (a lot of other library do).
> For example in portability.h, having:
>
The mechanism used for critical sections is an implementation detail
that is ideally invisible to the client application. I think it is
much more preferable to hide that implementation detail than to make
the build for the client application guess the value used to build the
library.

Re: How to log milliseconds?

Michaël CATANZARITI <mcatan <at> apache.org>
2004-08-16 18:46:39 GMT

Hi,
Yes it should work without any problem.
On which platform do you use log4cxx ?
Martin Lechner wrote:
> Hello log4cxx-user,
>
> I have a question:
> How do I log milliseconds in Patternlaypout?
> I tried with the %Q option as statet in the documentationlike this:
> %d{%H:%M:%S-%Q}
> but output schows a % sign after the seconds where the
> milliseconds should be...
> Anyone can help? Is it somehow possible to log microseconds?
>
>
>
--
--
Michaël CATANZARITI
log4cxx project manager
log4cxx user mailing list:
mailto:log4cxx-user-subscribe <at> logging.apache.org
log4cxx developer mailing list:
mailto:log4cxx-dev-subscribe <at> logging.apache.org

Re: ThreadSpecificData improvement.

Curt Arnold wrote:
>> Another solution is to typedef the main types we use in threading,
>> depending on PTHREAD (not HAVE_PTHREAD), and WIN32. This will require
>> the library user to add -DPTHREAD on it's compiler command line,
>> which is not a problem I think (a lot of other library do).
>> For example in portability.h, having:
>
> The mechanism used for critical sections is an implementation detail
> that is ideally invisible to the client application. I think it is
> much more preferable to hide that implementation detail than to make
> the build for the client application guess the value used to build the
> library.
Ok then let's go for pimpl. I'll keep you informed.
Cheers,
Christophe

v8plus Solaris instructions, asm code and atomic add

Barak Simon <barak.simon <at> db.com>
2004-08-17 00:05:38 GMT

Hi,
We have experienced crashes on Solaris which we think are partly to do with the -xarch=v8plus flag.
However, removing it is impossible (or is there a way?!) without disabling the assembly code
inside "thread.cpp". I have some questions on that:
1. Why was asm code used in the first place for atomic add instead of the solaris' InterlockedIncrement?
I suspect this was due to some bug in some version or other of SunOS implementation with conjunction of the v8
flags, but I'd
be most grateful to hear more details, or whether there is a specific CC/Solaris patch
that handles that.
2. Disabling the assembly code allows us to compile without the v8plus optimization flag (with the
downside of
not being thread-safe), and log4cxx seems to work fine with DOMConfigurator, but, alas, crashes on
PropertyConfigurator, this time
on the actual Solaris underlying __AtomicAdd32, when referencing stl strings (from within std::basic_string)
Any ideas on how to proceed will be welcome, as I am running out of any very quickly...
Many thanks,
Barak
PS - For anyone with morbid interest, below are two stack traces, both from PropertyConfigurator crash,
the first one
when using the -xarch=v8plus flag, and the second when disabling the sparc_atomic_add_32 method of
thread.cpp file
and building without that flag:
Stack trace for ProperyConfigurator - with v8plus instructions
=============================================

Building under Windows with command-line

Barak Simon <barak.simon <at> db.com>
2004-08-17 00:15:09 GMT

Hi,
Is there a simple way to build the log4cxx for Windows .NET 2003 using its (free) command-line compiler?
It may take some time until I can get an IDE license, so if there is, it would be most helpful.
(also, if (instead) someone can send me a binary dll version for Windows XP, built under .NET 2003 that could
also be a temporary solution for me)
Cheers,
Barak
________________________
Barak Simon
GED IT Core Platform
190 George St. Sydney, 2000
Deutsche Bank
Phone +61 2 925 85070
Fax +61 2 925 95050
--
This e-mail may contain confidential and/or privileged information. If you are not the intended
recipient (or have received this e-mail in error) please notify the sender immediately and destroy this
e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Re: Building under Windows with command-line

Curt Arnold <carnold <at> houston.rr.com>
2004-08-17 00:22:17 GMT

I have an Ant build script that will build log4cxx that I'll check with
the Visual C++ 2003 toolkit and commit. I've used to to build with
Borland C++ builder and to generate CBuilderX and Xcode project files.
On Aug 16, 2004, at 7:15 PM, Barak Simon wrote:
> Hi,
>
> Is there a simple way to build the log4cxx for Windows .NET 2003 using
> its (free) command-line compiler?
> It may take some time until I can get an IDE license, so if there is,
> it would be most helpful.
> (also, if (instead) someone can send me a binary dll version for
> Windows XP, built under .NET 2003 that could also be a temporary
> solution for me)
>
> Cheers,
> Barak