private void LogDbTraceWithProperties(
            string database
            , string procedureOrTypeOfExecuted
            , TimeSpan stopwatchElapsed
            , string commandText
            , string command
            , bool logViaWcf
            )
        {
            var logger = LogManager.GetLogger(database);

            var loggingEvent = new LoggingEvent(GetType(), logger.Logger.Repository, logger.Logger.Name, Level.Trace,
                                                string.Format(commandText, command),
                                                null);

            AddPropertiesDbTrace(database, procedureOrTypeOfExecuted, stopwatchElapsed, commandText, command,
                                 loggingEvent);

            try
            {
                // We want all exception/trace/audit/debug messages to be logged to file if the calling method was not explicitly called with "logViaWcf" parameter set to true
                // we also want all exception/trace/audit/debug messages to be logged to file if the "_logEverythingToFile" overrride was set to true (in application config)
                if (Convert.ToBoolean(_logEverythingToFile) || !logViaWcf)
                {
                    logger.Logger.Log(loggingEvent);
                }
            }
            catch (AggregateException ae)
            {
                ae.Handle(x => true);
            }
            catch (Exception)
            {
                // ignored
            }

            try
            {
                // We want all exception/trace/audit/debug messages to be logged to database via WCF if the calling method was explicitly called with "logViaWcf" parameter set to true
                // We also log to database via WCF if we have override property "_logEverythingViaWcf" set to true (in application config)
                // We also have one additional override property "_dontLogAnythingViaWcf", if this is set to true (in application config) we dont log anything to database (via WCF)
                if (logViaWcf || Convert.ToBoolean(_logEverythingViaWcf) && !Convert.ToBoolean(_dontLogAnythingViaWcf))
                {
                    if (_wcfAppenderService == null)
                    {
                        _wcfAppenderService = WcfLogFactory.GetWcfLogger();
                    }

                    _wcfAppenderService.AppendToLog(loggingEvent);
                }
            }
            catch (AggregateException ae)
            {
                ae.Handle(x => true);
            }
            catch (Exception)
            {
                // ignored
            }
        }
        private void LogMessageWithProperties(
            object logSource
            , string message
            , Level level
            , Exception exception
            , bool logViaWcf = false
            )
        {
            _logManager = GetMyLogger(logSource, level, _isMock);

            LogEvent = new LoggingEvent(logSource.GetType(), _logManager.Logger.Repository, _logManager.Logger.Name,
                                        level,
                                        message,
                                        null);

            AddProperties(logSource, exception, LogEvent);

            try
            {
                // We want all exception/trace/audit/debug messages to be logged to file if the calling method was not explicitly called with "logViaWcf" parameter set to true
                // we also want all exception/trace/audit/debug messages to be logged to file if the "_logEverythingToFile" overrride was set to true (in application config)
                if (Convert.ToBoolean(_logEverythingToFile) || !logViaWcf)
                {
                    _logManager.Logger.Log(LogEvent);
                }
            }
            catch (AggregateException ae)
            {
                ae.Handle(x => true);
            }
            catch (Exception)
            {
                // ignored
            }

            try
            {
                // We want all exception/trace/audit/debug messages to be logged to database via WCF if the calling method was explicitly called with "logViaWcf" parameter set to true
                // We also log to database via WCF if we have override property "_logEverythingViaWcf" set to true (in application config)
                // We also have one additional override property "_dontLogAnythingViaWcf", if this is set to true (in application config) we dont log anything to database (via WCF)
                if (logViaWcf || Convert.ToBoolean(_logEverythingViaWcf) && !Convert.ToBoolean(_dontLogAnythingViaWcf))
                {
                    if (_wcfAppenderService == null)
                    {
                        _wcfAppenderService = WcfLogFactory.GetWcfLogger();
                    }

                    _wcfAppenderService.AppendToLog(LogEvent);
                }
            }
            catch (AggregateException ae)
            {
                ae.Handle(x => true);
            }
            catch (Exception)
            {
                // ignored
            }
        }