本文整理汇总了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);
}
}
示例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);
}
示例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(() => "");
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例10: DisposeADDirectoryEntry
public void DisposeADDirectoryEntry(DirectoryEntry DirEntry, Logger Logger)
{
if (DirEntry != null)
{
DirEntry.Close();
}
Logger.Debug(@"Directory Entry Closed");
}
示例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();
}
示例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);
}
示例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();
}
示例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;
}
}
示例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();
}
}