You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Kenneth Shih (JIRA)" <ji...@apache.org> on 2009/02/13 01:56:59 UTC

[jira] Created: (LOG4NET-199) log4net not exactly threadsafe?

log4net not exactly threadsafe?
-------------------------------

                 Key: LOG4NET-199
                 URL: https://issues.apache.org/jira/browse/LOG4NET-199
             Project: Log4net
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.2.10
         Environment: Windows Server 2003
            Reporter: Kenneth Shih


 
Problem: We call log4net from our BizTalk 2006 orchestrations.  We noticed we were missing logging data. 
 
Doing a simple Nunit single threaded test, we would get all logged data. (repeatable)
In a Nunit multithreaded test, we would notice missed logged data. (repeatable)
Also, we also noticed  when BizTalk Host, when we lowered the amount of active threads down to 2 (the lowest we could go) 
 
So, We enabled debug tracing in log4net.  We also added various system.diag eventlogwrites around different parts of our code,  from where log4net was called, and also inside our appenders.
 
We noticed was saw an error in the debug tracing (using debugviewer)  log4net:ERROR [EventLogAppender] Attempted to append to closed appender named [EventLogAppender]. 
 
Also, by counting the number of eventlog entries we had from the various points, log4net itself was not calling the appenders each time it was called to log a message.
 
We seen this issue of log4net not calling the appenders, with a variety of different appenders, like the out of the box file and eventlog appenders and also our own msmq appender.
 
So log4net doesn't appear to be thread safe?  Any suggestions?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LOG4NET-199) log4net not exactly threadsafe?

Posted by "MK Pandey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12860806#action_12860806 ] 

MK Pandey commented on LOG4NET-199:
-----------------------------------

Hi All,

So you mean, if we are using web.config file for appender defintion, we can not have it thread safe?

Our situation is that we are using MDC values (ex, transID) to set additional values which is used across multiple classes to identify the transaction.

We have one LogHelper class which creates private static instance of the as below:

log4net.ILog fileLogger = LogManager.GetLogger(GetType());

When second thread starts and modifies the values, the subsequent logs from other threads start using the same values.

Any suggestions?

> log4net not exactly threadsafe?
> -------------------------------
>
>                 Key: LOG4NET-199
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-199
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.10
>         Environment: Windows Server 2003
>            Reporter: Kenneth Shih
>         Attachments: ThreadingTest.cs
>
>
>  
> Problem: We call log4net from our BizTalk 2006 orchestrations.  We noticed we were missing logging data. 
>  
> Doing a simple Nunit single threaded test, we would get all logged data. (repeatable)
> In a Nunit multithreaded test, we would notice missed logged data. (repeatable)
> Also, we also noticed  when BizTalk Host, when we lowered the amount of active threads down to 2 (the lowest we could go) 
>  
> So, We enabled debug tracing in log4net.  We also added various system.diag eventlogwrites around different parts of our code,  from where log4net was called, and also inside our appenders.
>  
> We noticed was saw an error in the debug tracing (using debugviewer)  log4net:ERROR [EventLogAppender] Attempted to append to closed appender named [EventLogAppender]. 
>  
> Also, by counting the number of eventlog entries we had from the various points, log4net itself was not calling the appenders each time it was called to log a message.
>  
> We seen this issue of log4net not calling the appenders, with a variety of different appenders, like the out of the box file and eventlog appenders and also our own msmq appender.
>  
> So log4net doesn't appear to be thread safe?  Any suggestions?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (LOG4NET-199) log4net not exactly threadsafe?

Posted by "Kenneth Shih (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4NET-199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kenneth Shih closed LOG4NET-199.
--------------------------------

    Resolution: Invalid

See last comment by Ken. This is not a bug in log4net, but a problem the way the user's custom wrapper class loading and calling log4net.




> log4net not exactly threadsafe?
> -------------------------------
>
>                 Key: LOG4NET-199
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-199
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.10
>         Environment: Windows Server 2003
>            Reporter: Kenneth Shih
>         Attachments: ThreadingTest.cs
>
>
>  
> Problem: We call log4net from our BizTalk 2006 orchestrations.  We noticed we were missing logging data. 
>  
> Doing a simple Nunit single threaded test, we would get all logged data. (repeatable)
> In a Nunit multithreaded test, we would notice missed logged data. (repeatable)
> Also, we also noticed  when BizTalk Host, when we lowered the amount of active threads down to 2 (the lowest we could go) 
>  
> So, We enabled debug tracing in log4net.  We also added various system.diag eventlogwrites around different parts of our code,  from where log4net was called, and also inside our appenders.
>  
> We noticed was saw an error in the debug tracing (using debugviewer)  log4net:ERROR [EventLogAppender] Attempted to append to closed appender named [EventLogAppender]. 
>  
> Also, by counting the number of eventlog entries we had from the various points, log4net itself was not calling the appenders each time it was called to log a message.
>  
> We seen this issue of log4net not calling the appenders, with a variety of different appenders, like the out of the box file and eventlog appenders and also our own msmq appender.
>  
> So log4net doesn't appear to be thread safe?  Any suggestions?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LOG4NET-199) log4net not exactly threadsafe?

Posted by "Ron Grabowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674086#action_12674086 ] 

Ron Grabowski commented on LOG4NET-199:
---------------------------------------

The current release of log4net has been out for a couple years now. I'm sure someone would have noticed by now if it was failing with just 2 threads.

> log4net not exactly threadsafe?
> -------------------------------
>
>                 Key: LOG4NET-199
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-199
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.10
>         Environment: Windows Server 2003
>            Reporter: Kenneth Shih
>
>  
> Problem: We call log4net from our BizTalk 2006 orchestrations.  We noticed we were missing logging data. 
>  
> Doing a simple Nunit single threaded test, we would get all logged data. (repeatable)
> In a Nunit multithreaded test, we would notice missed logged data. (repeatable)
> Also, we also noticed  when BizTalk Host, when we lowered the amount of active threads down to 2 (the lowest we could go) 
>  
> So, We enabled debug tracing in log4net.  We also added various system.diag eventlogwrites around different parts of our code,  from where log4net was called, and also inside our appenders.
>  
> We noticed was saw an error in the debug tracing (using debugviewer)  log4net:ERROR [EventLogAppender] Attempted to append to closed appender named [EventLogAppender]. 
>  
> Also, by counting the number of eventlog entries we had from the various points, log4net itself was not calling the appenders each time it was called to log a message.
>  
> We seen this issue of log4net not calling the appenders, with a variety of different appenders, like the out of the box file and eventlog appenders and also our own msmq appender.
>  
> So log4net doesn't appear to be thread safe?  Any suggestions?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LOG4NET-199) log4net not exactly threadsafe?

Posted by "Kenneth Shih (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675041#action_12675041 ] 

Kenneth Shih commented on LOG4NET-199:
--------------------------------------

Thanks for the input.  I changed the way we created a repository and got the config in our logging wrapper class.  We create a private static repository under speicifc domain name and make all the GetLogger calls create a log from that domain name and repo.   Now it works.  Sorry about that, I'll close this.




> log4net not exactly threadsafe?
> -------------------------------
>
>                 Key: LOG4NET-199
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-199
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.10
>         Environment: Windows Server 2003
>            Reporter: Kenneth Shih
>         Attachments: ThreadingTest.cs
>
>
>  
> Problem: We call log4net from our BizTalk 2006 orchestrations.  We noticed we were missing logging data. 
>  
> Doing a simple Nunit single threaded test, we would get all logged data. (repeatable)
> In a Nunit multithreaded test, we would notice missed logged data. (repeatable)
> Also, we also noticed  when BizTalk Host, when we lowered the amount of active threads down to 2 (the lowest we could go) 
>  
> So, We enabled debug tracing in log4net.  We also added various system.diag eventlogwrites around different parts of our code,  from where log4net was called, and also inside our appenders.
>  
> We noticed was saw an error in the debug tracing (using debugviewer)  log4net:ERROR [EventLogAppender] Attempted to append to closed appender named [EventLogAppender]. 
>  
> Also, by counting the number of eventlog entries we had from the various points, log4net itself was not calling the appenders each time it was called to log a message.
>  
> We seen this issue of log4net not calling the appenders, with a variety of different appenders, like the out of the box file and eventlog appenders and also our own msmq appender.
>  
> So log4net doesn't appear to be thread safe?  Any suggestions?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LOG4NET-199) log4net not exactly threadsafe?

Posted by "Ron Grabowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-199?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12673130#action_12673130 ] 

Ron Grabowski commented on LOG4NET-199:
---------------------------------------

"In a Nunit multithreaded test, we would notice missed logged data. (repeatable) "

Can you attach the failing tests to this ticket?

> log4net not exactly threadsafe?
> -------------------------------
>
>                 Key: LOG4NET-199
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-199
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.10
>         Environment: Windows Server 2003
>            Reporter: Kenneth Shih
>
>  
> Problem: We call log4net from our BizTalk 2006 orchestrations.  We noticed we were missing logging data. 
>  
> Doing a simple Nunit single threaded test, we would get all logged data. (repeatable)
> In a Nunit multithreaded test, we would notice missed logged data. (repeatable)
> Also, we also noticed  when BizTalk Host, when we lowered the amount of active threads down to 2 (the lowest we could go) 
>  
> So, We enabled debug tracing in log4net.  We also added various system.diag eventlogwrites around different parts of our code,  from where log4net was called, and also inside our appenders.
>  
> We noticed was saw an error in the debug tracing (using debugviewer)  log4net:ERROR [EventLogAppender] Attempted to append to closed appender named [EventLogAppender]. 
>  
> Also, by counting the number of eventlog entries we had from the various points, log4net itself was not calling the appenders each time it was called to log a message.
>  
> We seen this issue of log4net not calling the appenders, with a variety of different appenders, like the out of the box file and eventlog appenders and also our own msmq appender.
>  
> So log4net doesn't appear to be thread safe?  Any suggestions?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LOG4NET-199) log4net not exactly threadsafe?

Posted by "Ron Grabowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4NET-199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ron Grabowski updated LOG4NET-199:
----------------------------------

    Attachment: ThreadingTest.cs

The attached file uses 50 threads to write to 5 StringAppenders for 30 seconds. The StringAppenders all match at the end. Let me know if this is similar to what you tested and/or how I can change the test case to make it more accurate.

> log4net not exactly threadsafe?
> -------------------------------
>
>                 Key: LOG4NET-199
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-199
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.10
>         Environment: Windows Server 2003
>            Reporter: Kenneth Shih
>         Attachments: ThreadingTest.cs
>
>
>  
> Problem: We call log4net from our BizTalk 2006 orchestrations.  We noticed we were missing logging data. 
>  
> Doing a simple Nunit single threaded test, we would get all logged data. (repeatable)
> In a Nunit multithreaded test, we would notice missed logged data. (repeatable)
> Also, we also noticed  when BizTalk Host, when we lowered the amount of active threads down to 2 (the lowest we could go) 
>  
> So, We enabled debug tracing in log4net.  We also added various system.diag eventlogwrites around different parts of our code,  from where log4net was called, and also inside our appenders.
>  
> We noticed was saw an error in the debug tracing (using debugviewer)  log4net:ERROR [EventLogAppender] Attempted to append to closed appender named [EventLogAppender]. 
>  
> Also, by counting the number of eventlog entries we had from the various points, log4net itself was not calling the appenders each time it was called to log a message.
>  
> We seen this issue of log4net not calling the appenders, with a variety of different appenders, like the out of the box file and eventlog appenders and also our own msmq appender.
>  
> So log4net doesn't appear to be thread safe?  Any suggestions?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.