EventRecord.FormatDescription Method () always returns event message in en-US format RRS feed

  • Question

  • Hi team,

    I am working with EventRecord class.EventRecord class has method FormatDescription(Gets the event message in the current locale).When i use this method this returns always event message in english.

    My machine Language is : English (en-US) - (Chinesse - Simplified language pack imported).

    This is my code 

     static void Main(string[] args)
                var beforeCulture = Thread.CurrentThread.CurrentCulture;
                    Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-Hans");
                    string queryString =
                  "<QueryList>" +
                  "  <Query Id=\"0\" Path=\"Security\">" +
                  "    <Select Path=\"Security\">" +
                  "        *[System[(EventID = 4624)]]" +
                  "    </Select>" +
                  "  </Query>" +
                    EventLogQuery query = new EventLogQuery("Security", PathType.LogName, queryString);
                    EventLogReader reader = new EventLogReader(query);
                    reader.BatchSize = 10;
                    for (EventRecord eventInstance = reader.ReadEvent(); null != eventInstance; eventInstance = reader.ReadEvent())
                        string message = eventInstance.FormatDescription();                    
                        Console.WriteLine("Format Description is :" + message);
                        Console.WriteLine("Current Culture is "+Thread.CurrentThread.CurrentCulture);
                }catch(Exception e)
                    Thread.CurrentThread.CurrentCulture = beforeCulture;

    Output :

    Format Description is :An account was successfully logged on.

            Security ID:            S-1-0-0
            Account Name:           -
            Account Domain:         -
            Logon ID:               0x0

    Logon Information:
            Logon Type:             0
            Restricted Admin Mode:  -
            Virtual Account:                No
            Elevated Token:         Yes

    Impersonation Level:            -

    New Logon:
            Security ID:            S-1-5-18
            Account Name:           SYSTEM
            Account Domain:         NT AUTHORITY
            Logon ID:               0x3E7
            Linked Logon ID:                0x0
            Network Account Name:   -
            Network Account Domain: -
            Logon GUID:             {00000000-0000-0000-0000-000000000000}

    Process Information:
            Process ID:             0x4
            Process Name:

    Network Information:
            Workstation Name:       -
            Source Network Address: -
            Source Port:            -

    Detailed Authentication Information:
            Logon Process:          -
            Authentication Package: -
            Transited Services:     -
            Package Name (NTLM only):       -
            Key Length:             0

    This event is generated when a logon session is created. It is generated on the computer that was accessed.

    The subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.

    The logon type field indicates the kind of logon that occurred. The most common types are 2 (interactive) and 3 (network).

    The New Logon fields indicate the account for whom the new logon was created, i.e. the account that was logged on.

    The network fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.

    The impersonation level field indicates the extent to which a process in the logon session can impersonate.

    The authentication information fields provide detailed information about this specific logon request.
            - Logon GUID is a unique identifier that can be used to correlate this event with a KDC event.
            - Transited services indicate which intermediate services have participated in this logon request.
            - Package name indicates which sub-protocol was used among the NTLM protocols.
            - Key length indicates the length of the generated session key. This will be 0 if no session key was requested.

    Current Culture is zh-Hans

    Thanks in Advance

    Monday, January 8, 2018 2:40 PM

All replies

  • Hello Balakumar,


    Gets   the event message in the current locale.

    The description indicates the event message is based on your windows language system rather than CultureInfo environment. If you want to get the event information in Chinese. You need to set your computer language as Chinese and run the above code you will get Chinese information. As for how to set, you could follow the below steps(windows 10).

    open control panel>> choose "Clock, Language and Region" >>"Language" >>" Advanced settings">>

    choose language ,saved and then restart computer. Run the above code you will find event log information in Chinese.

    Best regards,

    Neil Hu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Tuesday, January 9, 2018 7:03 AM