[ 
https://issues.apache.org/jira/browse/LOGCXX-394?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thorsten Schöning resolved LOGCXX-394.
--------------------------------------

    Resolution: Fixed

LOGCXX-394: With removing static in Level::get* some of the tests failed 
because they relied on the fact that LevelPtr overrides operator== by comparing 
pointers and because of the static levels those pointers where always the same 
for every level. I changed this by LevelPtr overriding operator== on it's own 
and comparing the level values instead of it's pointers. The seems to make more 
sense for Levels anyways, especially because Level::equals already behaved that 
way and ignored the pointer of LevelPtr, but compared it's level value instead.

I'll focus on == and != for now and not override each method of ObjectPtr 
because those 2 are only used in Level.

We don't have many options anyways, either we revert to using sttaic levels and 
introduce the bug again or we need to adopt already written code to compare 
using a cast or such.

> Levels are not thread safe
> --------------------------
>
>                 Key: LOGCXX-394
>                 URL: https://issues.apache.org/jira/browse/LOGCXX-394
>             Project: Log4cxx
>          Issue Type: Bug
>          Components: Appender
>         Environment: Windows 7, Visual Studio 2010 SP1
>            Reporter: Petro Protsyk
>            Assignee: Thorsten Schöning
>            Priority: Minor
>              Labels: thread-safety
>
> Level.cpp. All default level variables are function static. This is not 
> thread safe, especially in Visual C++ compiler.
> Here is code to reproduce the issue in VC++ 2010:
>     Concurrency::parallel_for (int(0), int(10), [&](int i) 
>     { 
>         if (::log4cxx::Level::getWarn() == NULL) 
>         { 
>             throw std::exception(); 
>         } 
>      }); 



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to