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 "Hao Zhang (JIRA)" <ji...@apache.org> on 2010/03/08 18:55:29 UTC

[jira] Created: (LOG4NET-250) Drastically decrease amount of time needed for LoggingEvent.UserName

Drastically decrease amount of time needed for LoggingEvent.UserName
--------------------------------------------------------------------

                 Key: LOG4NET-250
                 URL: https://issues.apache.org/jira/browse/LOG4NET-250
             Project: Log4net
          Issue Type: Improvement
          Components: Core
    Affects Versions: 1.2.10
            Reporter: Hao Zhang


Currently, each LoggingEvent retrieves the logged on user using 
WindowsIdentity.GetCurrent() which takes a long time

One can obtain drastic improvements by switching to Environment.UserDomain and Environment.UserName

Here are some numbers on my box running Windows XP SP3, .NET 2.0, debug mode.
Using Environment:


            for (int i = 0; i < 50000; i++)
            {
               var x = (Environment.UserDomainName);
            }

takes 4294 milliseconds to run (4.294) using Stopwatch

Using WindowsIdentity:
            for (int i = 0; i < 50000; i++)
            {
                var x = (WindowsIdentity.GetCurrent().Name);
            }
            start.Stop();

takes 20191 (20 seconds) milliseconds to run,

Thus, it takes almost 5x longer to use WindowsIdentity.

This isn't much of an issue if you're not logging extremely high quantities or do not log the user name.
However, I'm currently using XmlLayoutSchemaLog4j which forces the retrieval of said information for the log4net:UserName property.


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


[jira] Commented: (LOG4NET-250) Drastically decrease amount of time needed for LoggingEvent.UserName

Posted by "Walden Leverich (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12857511#action_12857511 ] 

Walden Leverich commented on LOG4NET-250:
-----------------------------------------

The semantics of WindowsIdentity.GetCurrent() are different from that of Environment.UserName. I understand why you'd want the faster one, but GetCurrent() respects impersonation while Environment.UserName doesn't, and that's an important distinction. Perhaps a new LoggingEvent.ProcessUserName would make sense?

> Drastically decrease amount of time needed for LoggingEvent.UserName
> --------------------------------------------------------------------
>
>                 Key: LOG4NET-250
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-250
>             Project: Log4net
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.2.10
>            Reporter: Hao Zhang
>
> Currently, each LoggingEvent retrieves the logged on user using 
> WindowsIdentity.GetCurrent() which takes a long time
> One can obtain drastic improvements by switching to Environment.UserDomain and Environment.UserName
> Here are some numbers on my box running Windows XP SP3, .NET 2.0, debug mode.
> Using Environment:
>             for (int i = 0; i < 50000; i++)
>             {
>                var x = (Environment.UserDomainName + "\\" + Environment.UserName);
>             }
> takes 4294 milliseconds to run (4.294) using Stopwatch
> Using WindowsIdentity:
>             for (int i = 0; i < 50000; i++)
>             {
>                 var x = (WindowsIdentity.GetCurrent().Name);
>             }
>             start.Stop();
> takes 20191 (20 seconds) milliseconds to run,
> Thus, it takes almost 5x longer to use WindowsIdentity.
> This isn't much of an issue if you're not logging extremely high quantities or do not log the user name.
> However, I'm currently using XmlLayoutSchemaLog4j which forces the retrieval of said information for the log4net:UserName property.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (LOG4NET-250) Drastically decrease amount of time needed for LoggingEvent.UserName

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

Hao Zhang updated LOG4NET-250:
------------------------------

    Description: 
Currently, each LoggingEvent retrieves the logged on user using 
WindowsIdentity.GetCurrent() which takes a long time

One can obtain drastic improvements by switching to Environment.UserDomain and Environment.UserName

Here are some numbers on my box running Windows XP SP3, .NET 2.0, debug mode.
Using Environment:


            for (int i = 0; i < 50000; i++)
            {
               var x = (Environment.UserDomainName + "\\" + Environment.UserName);
            }

takes 4294 milliseconds to run (4.294) using Stopwatch

Using WindowsIdentity:
            for (int i = 0; i < 50000; i++)
            {
                var x = (WindowsIdentity.GetCurrent().Name);
            }
            start.Stop();

takes 20191 (20 seconds) milliseconds to run,

Thus, it takes almost 5x longer to use WindowsIdentity.

This isn't much of an issue if you're not logging extremely high quantities or do not log the user name.
However, I'm currently using XmlLayoutSchemaLog4j which forces the retrieval of said information for the log4net:UserName property.


  was:
Currently, each LoggingEvent retrieves the logged on user using 
WindowsIdentity.GetCurrent() which takes a long time

One can obtain drastic improvements by switching to Environment.UserDomain and Environment.UserName

Here are some numbers on my box running Windows XP SP3, .NET 2.0, debug mode.
Using Environment:


            for (int i = 0; i < 50000; i++)
            {
               var x = (Environment.UserDomainName);
            }

takes 4294 milliseconds to run (4.294) using Stopwatch

Using WindowsIdentity:
            for (int i = 0; i < 50000; i++)
            {
                var x = (WindowsIdentity.GetCurrent().Name);
            }
            start.Stop();

takes 20191 (20 seconds) milliseconds to run,

Thus, it takes almost 5x longer to use WindowsIdentity.

This isn't much of an issue if you're not logging extremely high quantities or do not log the user name.
However, I'm currently using XmlLayoutSchemaLog4j which forces the retrieval of said information for the log4net:UserName property.



> Drastically decrease amount of time needed for LoggingEvent.UserName
> --------------------------------------------------------------------
>
>                 Key: LOG4NET-250
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-250
>             Project: Log4net
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.2.10
>            Reporter: Hao Zhang
>
> Currently, each LoggingEvent retrieves the logged on user using 
> WindowsIdentity.GetCurrent() which takes a long time
> One can obtain drastic improvements by switching to Environment.UserDomain and Environment.UserName
> Here are some numbers on my box running Windows XP SP3, .NET 2.0, debug mode.
> Using Environment:
>             for (int i = 0; i < 50000; i++)
>             {
>                var x = (Environment.UserDomainName + "\\" + Environment.UserName);
>             }
> takes 4294 milliseconds to run (4.294) using Stopwatch
> Using WindowsIdentity:
>             for (int i = 0; i < 50000; i++)
>             {
>                 var x = (WindowsIdentity.GetCurrent().Name);
>             }
>             start.Stop();
> takes 20191 (20 seconds) milliseconds to run,
> Thus, it takes almost 5x longer to use WindowsIdentity.
> This isn't much of an issue if you're not logging extremely high quantities or do not log the user name.
> However, I'm currently using XmlLayoutSchemaLog4j which forces the retrieval of said information for the log4net:UserName property.

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