disable log warrinng

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 anni tempo fa
hi

i'm running version 3.4
my sql log table is very big and i want to log only errors  not warnings
how can i achieve this ?

i found this post
https://www.nopcommerce.com/boards/t/15592/disable-warning-log-v24.aspx but my code look diffrent
and also i hope that in 3.4 there is a way to do this without decompile re recompile the code

please help....

Nir
7 anni tempo fa
Nir Shani wrote:
hi

i'm running version 3.4
my sql log table is very big and i want to log only errors  not warnings
how can i achieve this ?

i found this post
https://www.nopcommerce.com/boards/t/15592/disable-warning-log-v24.aspx but my code look diffrent
and also i hope that in 3.4 there is a way to do this without decompile re recompile the code

please help....

Nir


Solution is already provided by Andrei in link you mentioned above, this is a duplicate post.
Please avoid duplicating post by applying solutions mentioned in other posts.


Open following file in visual studio:
..\Libraries\Nop.Services\Logging\DefaultLogger.cs

Add one line code in IsEnabled method

 #region Methods

        /// <summary>
        /// Determines whether a log level is enabled
        /// </summary>
        /// <param name="level">Log level</param>
        /// <returns>Result</returns>
        public virtual bool IsEnabled(LogLevel level)
        {
            switch(level)
            {
                case LogLevel.Debug:
      case LogLevel.Warning:
                    return false;
                default:
                    return true;
            }
        }


Added one line
case LogLevel.Warning:

Compile the solution and it will not log warning log.
7 anni tempo fa
(Are you getting lots of warnings?)

Consider using this setting  commonsettings.ignorelogwordlist
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.