当前位置: 首页>>代码示例>>C#>>正文


C# Logger.Debug方法代码示例

本文整理汇总了C#中NLog.Logger.Debug方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.Debug方法的具体用法?C# Logger.Debug怎么用?C# Logger.Debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NLog.Logger的用法示例。


在下文中一共展示了Logger.Debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

 static void Main(string[] args)
 {
     try
     {
         log = LogManager.GetCurrentClassLogger();
         BookListService bls = new BookListService();
         log.Debug("Старт записи в двоичный файл");
             WriteDefaultValues(fileName);
         log.Debug("Окончание записи в двоичный файл");
         log.Debug("Старт чтения данных из двоичног файла");
         bls = ReadDefaultValues(fileName);
         log.Debug("Окончание чтения данных из двоичног файла");
         Book[] find = bls.FindByTag("1999", EnumTag.Year); //Поиск
         foreach (Book b in find)
         Console.WriteLine(b);
         Console.WriteLine("-------------------------");
         Book[] sort = bls.SortBooksByTag(EnumTag.Page);//Сортировка
         foreach (Book b in sort)
             Console.WriteLine(b);
         //log.Warn("Попытка добавить уже существующую книгу");
         //bls.AddBook(sort[0]); 
         bls.RemoveBook(sort[0]);//Удаление книги
         log.Warn("Попытка удаления книги отсутствующей в каталоге");
         bls.RemoveBook(sort[0]);
     }
     catch (Exception e)
     {
         log.Error(e.Message);
     }
     
 }
开发者ID:eduard-posmetuhov,项目名称:ASP.NET.Posmetuhov.Day5,代码行数:31,代码来源:Program.cs

示例2: VersionOneClient

        //Constructor: Initializes the V1 instance connection.
        public VersionOneClient(IntegrationConfiguration Config, Logger Logger)
        {
            _logger = Logger;
            _config = Config;
            _V1_META_URL = Config.V1Connection.Url + "/meta.v1/";
            _V1_DATA_URL = Config.V1Connection.Url + "/rest-1.v1/";
            V1APIConnector metaConnector = new V1APIConnector(_V1_META_URL);
            V1APIConnector dataConnector;

            //Set V1 connection based on authentication type.
            if (_config.V1Connection.UseWindowsAuthentication == true)
            {
                _logger.Debug("-> Connecting with Windows Authentication.");

                //If username is not specified, try to connect using domain credentials.
                if (String.IsNullOrEmpty(_config.V1Connection.Username))
                {
                    _logger.Debug("-> Connecting with default Windows domain account: {0}\\{1}", Environment.UserDomainName, Environment.UserName);
                    dataConnector = new V1APIConnector(_V1_DATA_URL);
                }
                else
                {
                    _logger.Debug("-> Connecting with specified Windows domain account: {0}", _config.V1Connection.Username);
                    dataConnector = new V1APIConnector(_V1_DATA_URL, _config.V1Connection.Username, _config.V1Connection.Password, true);
                }
            }
            else
            {
                _logger.Debug("-> Connecting with V1 account credentials: {0}", _config.V1Connection.Username);
                dataConnector = new V1APIConnector(_V1_DATA_URL, _config.V1Connection.Username, _config.V1Connection.Password);
            }

            _v1Meta = new MetaModel(metaConnector);
            _v1Data = new Services(_v1Meta, dataConnector);
        }
开发者ID:TerryDensmore,项目名称:VersionOne.Integration.HelpStar,代码行数:36,代码来源:VersionOneClient.cs

示例3: NLogLog

 /// <summary>
 /// Create a new NLog logger instance.
 /// </summary>
 /// <param name="name">Name of type to log as.</param>
 public NLogLog([NotNull] NLog.Logger log, [NotNull] string name)
 {
     if (name == null)
         throw new ArgumentNullException("name");
     _log = log;
     _log.Debug(() => "");
 }
开发者ID:raelyard,项目名称:Topshelf,代码行数:11,代码来源:NLogLog.cs

示例4: GetADGroup

        public Group GetADGroup(ActiveDirectoryClient ADClient, string GroupNameSearchString, Logger Logger)
        {
            List<IGroup> foundGroups = null;

            try
            {
                Logger.Debug(string.Format("Searching/Fetching AD Group {0}", GroupNameSearchString));
                foundGroups = ADClient.Groups
                    .Where(group => group.DisplayName.StartsWith(GroupNameSearchString))
                    .ExecuteAsync().Result.CurrentPage.ToList();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error when fetching group from Azure Active Directory {0} {1}", ex.Message, ex.InnerException != null ? ex.InnerException.Message : "");
                Logger.Error(String.Format("Error when fetching group from Azure Active Directory {0} {1}", ex.Message, ex.InnerException != null ? ex.InnerException.Message : ""));
            }
            if (foundGroups != null && foundGroups.Count > 0)
            {
                return foundGroups.First() as Group;
            }
            else
            {
                return null;
            }
        }
开发者ID:spSlaine,项目名称:ADCST,代码行数:25,代码来源:AzureADFunctions.cs

示例5: ADClient

        public ActiveDirectoryClient ADClient(IConfiguration Configuration, IAuthenticationProvidor authProvidor, Logger Logger)
        {
            ActiveDirectoryClient activeDirectoryClient;
            try
            {
                Logger.Debug(@"Connecting to Azure Active Directory GraphAPI to get ClientSession");
                activeDirectoryClient = authProvidor.GetActiveDirectoryClientAsApplication(Configuration);

                if (activeDirectoryClient != null)
                {
                    return activeDirectoryClient;
                }
                else
                {
                    return null;
                }
            }
            catch (AuthenticationException ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Acquiring a token failed with the following error: {0}", ex.Message);
                Logger.Error(String.Format(@"Could not aquire Azure active Directory Authentication Token {0}", ex.Message));

                if (ex.InnerException != null)
                {
                    //InnerException Message will contain the HTTP error status codes mentioned in the link above
                    Console.WriteLine("Error detail: {0}", ex.InnerException.Message);
                    Logger.Error(String.Format(@"Error detail {0}", ex.InnerException));

                }
                Console.ResetColor();
                return null;
            }
        }
开发者ID:spSlaine,项目名称:ADCST,代码行数:34,代码来源:AzureADFunctions.cs

示例6: Compile

        public static ABIExitCode Compile(ABIFileSystemOptions options, LogFactory factory)
        {
            #region Argument exceptions

            if (options == null)
                throw new ArgumentNullException("options");

            if (factory == null)
                throw new ArgumentNullException("factory");

            #endregion

            _logger = factory.GetCurrentClassLogger();
            _logger.Debug(options);
            try
            {
                if (!Validate(options))
                    return ABIExitCode.ErrorDuringValidation;

                var engine = new CompilerEngine(options, factory);

                var result = engine.Compile();
                Debug.Assert(result != ABIExitCode.ErrorExitCodeUnassigned);
                return result;
            }
            catch (Exception ex) // avoid external unhandled exceptions
            {
                _logger.Error(ex);
            }

            return ABIExitCode.ErrorUnhandledException;
        }
开发者ID:SolidQIT,项目名称:ABI-Compiler,代码行数:32,代码来源:ABIFileSystemCompiler.cs

示例7: Execute

        public void Execute()
        {
            _logger = LogManager.GetLogger("log");

            try
            {

                InitializeLoggingConfiguration();

                Application.AddMessageFilter(KeyboardTracking.Instance);
                SdlTradosStudio.Application.Closing += Application_Closing;

                _service = new KeyboardTrackingService(_logger);
                _editorController = SdlTradosStudio.Application.GetController<EditorController>();
                _editorController.Opened += _editorController_Opened;
                _editorController.ActiveDocumentChanged += _editorController_ActiveDocumentChanged;
                _editorController.Closing += _editorController_Closing;

                var twitterPersistenceService = new TwitterPersistenceService(_logger);
                if (twitterPersistenceService.HasAccountConfigured) return;
                using (var tForm = new TwitterAccountSetup(twitterPersistenceService))
                {
                    tForm.ShowDialog();
                }
            }
            catch (Exception ex)
            {

                _logger.Debug(ex,"Unexpected exception when intializing the app");
                throw;
            }
        }
开发者ID:paulfilkin,项目名称:Sdl-Community,代码行数:32,代码来源:Initializer.cs

示例8: GetADDirectoryEntry

        public DirectoryEntry GetADDirectoryEntry(string FQDomainName, string LDAPPath, Logger Logger)
        {
            Logger.Debug(string.Format(@"Getting Directory Entry for LDAP Path {0}", LDAPPath));

            //DirectoryEntry LDAPConnection = new DirectoryEntry(FQDomainName);
            DirectoryEntry LDAPConnection = new DirectoryEntry("LDAP://"+FQDomainName);

            LDAPConnection.Path = "LDAP://"+LDAPPath;
            LDAPConnection.AuthenticationType = AuthenticationTypes.Secure;

               try
               {
               //Try fetch to Native ADSI Object  - if this passes Then we know that we
               //are authenticated. If an exception is thrown then we know we are using an Invalid Account.

               object DirEntryNativeObject = LDAPConnection.NativeObject;

               }
               catch (Exception ex)
               {
               Logger.Error(String.Format("Error authenticating to Active Directory with current running user. {0} {1}.",
                   ex.Message, ex.InnerException != null ? ex.InnerException.Message : ""));

               throw new Exception(String.Format("Error authenticating to Active Directory with current running user. {0} {1}.",
                   ex.Message, ex.InnerException != null ? ex.InnerException.Message : "" ));
               }

               return LDAPConnection;
        }
开发者ID:spSlaine,项目名称:ADCST,代码行数:29,代码来源:OnPremADHelper.cs

示例9: Memcached

 /// <summary>
 /// Constructeur permettant de définir les arguments à passer en ligne de commande à memcached.
 /// </summary>
 /// <param name="defaultArguments">Arguments par défaut à passer à la commande de memcached (peut être <c>null</c>).</param>
 public Memcached(string[] defaultArguments)
 {
     _logger = LogManager.GetLogger(this.GetType().Name);
     _defaultArgs = defaultArguments;
     _memCachedPath = Resources.Resources.ExtractMemcachedToTemporaryDirectory();
     _tempDir = Path.GetDirectoryName(_memCachedPath);
     _logger.Debug("Exécutable memcached extrait dans le dossier temporaire {0}.", _tempDir);
 }
开发者ID:eric-b,项目名称:MemcachedService64,代码行数:12,代码来源:Memcached.cs

示例10: DisposeADDirectoryEntry

        public void DisposeADDirectoryEntry(DirectoryEntry DirEntry, Logger Logger)
        {
            if (DirEntry != null)
            {
                DirEntry.Close();
            }

            Logger.Debug(@"Directory Entry Closed");
        }
开发者ID:spSlaine,项目名称:ADCST,代码行数:9,代码来源:OnPremADHelper.cs

示例11: Application_Start

        protected void Application_Start()
        {
            logger = LogManager.GetCurrentClassLogger();
            logger.Debug("Application Started.");
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
        }
开发者ID:skalinkin,项目名称:WPAgent,代码行数:12,代码来源:Global.asax.cs

示例12: ProdutosController

        public ProdutosController()
        {
            var factory = new LogFactory();

            _logger = factory.GetLogger("Default");

            _logger.Debug("Criando Controller");

            // var produtoRepository = new ProdutoADORepository();
            var produtoRepository = new ProdutoEFRepository();
            var departamentoRepository = new DepartamentoEFRepository();

            _catalogoService = new CatalogoService(produtoRepository, departamentoRepository);
        }
开发者ID:TiagoSoczek,项目名称:MOC,代码行数:14,代码来源:ProdutosController.cs

示例13: MemcachedService

        public MemcachedService()
        {
            _logger = LogManager.GetLogger(this.GetType().Name);
            _logger.Debug(string.Format("Instanciation du service {0} ({1})...\r\nExécution 64 bits: {2}\r\nPf: {3}", _serviceName, _applicationPath, IntPtr.Size == 8, Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)));
            this.ServiceName = _serviceName;
            EventLog.Source = _serviceName;
            this.EventLog.Log = "Application";
            this.AutoLog = true;

            this.CanHandlePowerEvent = false;
            this.CanHandleSessionChangeEvent = false;
            this.CanPauseAndContinue = false;
            this.CanStop = true;

            _memCached = new Memcached();
        }
开发者ID:eric-b,项目名称:MemcachedService64,代码行数:16,代码来源:MemcachedService.cs

示例14: DoWrite

 private void DoWrite(Logger logger, LogLevel level, string message)
 {
     switch (level)
     {
         case LogLevel.Debug:
             logger.Debug(message);
             break;
         case LogLevel.Info:
             logger.Info(message);
             break;
         case LogLevel.Trace:
             logger.Trace(message);
             break;
         case LogLevel.Error:
         default:
             logger.Error(message);
             break;
     }
 }
开发者ID:zhangfaguo,项目名称:ShowTime,代码行数:19,代码来源:LogHelper.cs

示例15: Execute

        public void Execute()
        {
            _logger = LogManager.GetLogger("log");
            #if DEBUG
            {
                _emailService = new EmailService(true);
            }
            #else
            {
                _emailService = new EmailService(false);
            }
            #endif

            try
            {

                InitializeLoggingConfiguration();

                Application.AddMessageFilter(KeyboardTracking.Instance);
                SdlTradosStudio.Application.Closing += Application_Closing;

                _service = new KeyboardTrackingService(_logger,_emailService);
                _editorController = SdlTradosStudio.Application.GetController<EditorController>();
                _editorController.Opened += _editorController_Opened;
                _editorController.ActiveDocumentChanged += _editorController_ActiveDocumentChanged;
                _editorController.Closing += _editorController_Closing;

                var twitterPersistenceService = new TwitterPersistenceService(_logger);
                if (twitterPersistenceService.HasAccountConfigured) return;
                using (var tForm = new TwitterAccountSetup(twitterPersistenceService))
                {
                    tForm.ShowDialog();
                }
                _logger.Info(string.Format("Started productivity plugin version {0}",VersioningService.GetPluginVersion()));
            }
            catch (Exception ex)
            {
                _logger.Debug(ex,"Unexpected exception when intializing the app");
                _emailService.SendLogFile();
            }
        }
开发者ID:crashracer,项目名称:Sdl-Community,代码行数:41,代码来源:Initializer.cs


注:本文中的NLog.Logger.Debug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。