protected virtual void FixVolatileData()

in src/log4net/Core/LoggingEvent.cs [1261:1346]


        protected virtual void FixVolatileData(FixFlags flags)
        {
            object forceCreation = null;

            //Unlock the cache so that new values can be stored
            //This may not be ideal if we are no longer in the correct context
            //and someone calls fix. 
            m_cacheUpdatable = true;

            // determine the flags that we are actually fixing
            var updateFlags = (FixFlags)((flags ^ m_fixFlags) & flags);

            if (updateFlags > 0)
            {
                if ((updateFlags & FixFlags.Message) != 0)
                {
                    // Force the message to be rendered
                    forceCreation = this.RenderedMessage;

                    m_fixFlags |= FixFlags.Message;
                }

                if ((updateFlags & FixFlags.ThreadName) != 0)
                {
                    // Grab the thread name
                    forceCreation = this.ThreadName;

                    m_fixFlags |= FixFlags.ThreadName;
                }

                if ((updateFlags & FixFlags.LocationInfo) != 0)
                {
                    // Force the location information to be loaded
                    forceCreation = this.LocationInformation;

                    m_fixFlags |= FixFlags.LocationInfo;
                }

                if ((updateFlags & FixFlags.UserName) != 0)
                {
                    // Grab the user name
                    forceCreation = this.UserName;

                    m_fixFlags |= FixFlags.UserName;
                }

                if ((updateFlags & FixFlags.Domain) != 0)
                {
                    // Grab the domain name
                    forceCreation = this.Domain;

                    m_fixFlags |= FixFlags.Domain;
                }

                if ((updateFlags & FixFlags.Identity) != 0)
                {
                    // Grab the identity
                    forceCreation = this.Identity;

                    m_fixFlags |= FixFlags.Identity;
                }

                if ((updateFlags & FixFlags.Exception) != 0)
                {
                    // Force the exception text to be loaded
                    forceCreation = GetExceptionString();

                    m_fixFlags |= FixFlags.Exception;
                }

                if ((updateFlags & FixFlags.Properties) != 0)
                {
                    CacheProperties();

                    m_fixFlags |= FixFlags.Properties;
                }
            }

            // avoid warning CS0219
            if (forceCreation != null)
            {
            }

            //Finaly lock everything we've cached.
            m_cacheUpdatable = false;
        }