[ 
https://issues.apache.org/jira/browse/LOG4NET-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12671461#action_12671461
 ] 

Ashish Khandelwal commented on LOG4NET-195:
-------------------------------------------

I just updated the code to put Log4Net call on separate Thread, this rapidly 
improved the performance. Almost equivalent to the nSpring (some times better 
than nSpring)

Explanation about the code:
When user sends a message to log, I added sent log into the array list instead 
of sending this message directly to log4net. This increases the response time. 
Another method "Write" is running on separate thread which always looks to the 
array list and sends the message to the log4net to write. 

It looks like a better way to improve the response time. Let me know your view 
and if you find any other way(s) as well:

       static bool blnStop = false;
        static ApplicationLog()
        {
            Thread t = new Thread(Write);
            t.Priority = ThreadPriority.BelowNormal;
            t.Start();
        }
        static ArrayList arlLogs = new ArrayList();
        
        /// <summary>
        /// Log Debug
        /// </summary>
        /// <param name="message">Message to be logged</param>
        /// <param name="methodName">Method Name(Location)</param>
        public static void WriteDebug(string message, string methodName)
        {
            arlLogs.Add(methodName + " " + message);
            
        }

        private static void Write()
        {
            while (!blnStop)
            {
                if (log.IsDebugEnabled)
                {
                    if (arlLogs.Count > 0)
                    {
                        log.Info(arlLogs[0]);
                        arlLogs.RemoveAt(0);
                    }
                }
            }

> Log4Net Performance comparison with other logging utility
> ---------------------------------------------------------
>
>                 Key: LOG4NET-195
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-195
>             Project: Log4net
>          Issue Type: Test
>    Affects Versions: 1.2.10
>         Environment: .Net Framework 2.0, VS 2005, Windows XP
>            Reporter: Ashish Khandelwal
>            Priority: Critical
>         Attachments: Log4Net_Vs_nSpring.zip
>
>
> I developed one utility to compare the performance between Log4Net and 
> nSpring(another logging utility). The result I saw is surprise to me - 
> Log4Net took more time than nSpring. It is surprise because "Log4net claims 
> to be fast and flexible: speed first, flexibility second."
> Log4Net says: 
> (http://logging.apache.org/log4net/release/manual/internals.html)
> One of the often-cited arguments against logging is its computational cost. 
> This is a legitimate concern as even moderately sized applications can 
> generate thousands of log requests. Much effort was spent measuring and 
> tweaking logging performance. Log4net claims to be fast and flexible: speed 
> first, flexibility second.
> Although test is saying Log4Net takes more time, I am still not convinced 
> with the result achieved, considering the fact; Log4Net is widely accepted by 
> the industry and known for its speed, reliability and flexibility.
> I would like to know why Log4Net is taking more time, we might be missing any 
> setting or other which can boost the performance. Can you please help to know 
> the reason?

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

Reply via email to