[ 
https://issues.apache.org/jira/browse/LOGGING-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13553697#comment-13553697
 ] 

Sebb commented on LOGGING-135:
------------------------------

I agree it's unlikely to occur, however that does not mean it cannot occur.
And if it does cause problems, debugging is likely to be extremely difficult.

It may well be that all logger implementations return a singleton.
But writing to the protected logger field can still cause issues.

At the very least the issue should be clearly documented.

Making the variable volatile would solve the publication issue.
Ideally the variables should be private and final, but that would break 
compatibility.

If logging is ever rewritten, it should use immutable classes as far as 
possible, and certainly no mutable protected or public fields.
                
> Thread-safety improvements
> --------------------------
>
>                 Key: LOGGING-135
>                 URL: https://issues.apache.org/jira/browse/LOGGING-135
>             Project: Commons Logging
>          Issue Type: Bug
>            Reporter: Sebb
>
> The LogKitLogger.logger field is not final or volatile so changes are not 
> guaranteed to be published.
> This includes calls to getLogger(), so two different threads using the same 
> instance can theoretically both create the logger.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to