event-log

How to determinde dns changes in c#?

你离开我真会死。 提交于 2019-12-10 17:39:18
问题 I want to monitor the dns address changes. So i need to track dns changes. I am doing it with thread right now. I get dns and save it file and then i compare they every 10 sec but i need more specific solution. For exampe, is there any event for that? This is the code: GetDns: public List<string> GetDns() { List<string> dns = new List<string>(); NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface networkInterface in networkInterfaces) {

Creating an application and event logs in the “applications and services logs” section of the event viewer

五迷三道 提交于 2019-12-10 17:12:53
问题 I have a .NET application in which I want to write unhandled events to the event viewer. I noticed that there is a directory called "Applications and Services Logs". I would like to create an entry for my application in this directory and write any unhandled events to it. Unfortunately, I can't find any documentation. Is this even possible? If so, how? Thanks! 回答1: You can create a log entry with this method : public static void CreateEventSource( string YourApplication, string YourLogName )

EventLog logs in Application, even though set to another log

血红的双手。 提交于 2019-12-10 16:33:39
问题 I have created an EventLog object in my application, that I use to log to my own log, created like this: if (!System.Diagnostics.EventLog.SourceExists("MyApplication")) { System.Diagnostics.EventLog.CreateEventSource( "MySource", "MyApplication"); } eventLog.Source = "MySource"; eventLog.Log = "MyApplication"; I log entries like this: eventLog.WriteEntry("some log line"); When inspecting the eventLog object, it says the Log is set to "MyApplication" . However, the logging always goes to the

EventLog WriteEntry does not write to designated log, but to Application log

[亡魂溺海] 提交于 2019-12-10 14:52:37
问题 I have an application where I want to write entries to event log The logger is instantiated through MEF. I created a derived class, to be able to perform the log initializations prior of using it. My code is as below: public class WinEventLog : EventLog, ILogger { private const string LOG_SourceName = "DataGen_Source"; private const string LOG_SysLogName = "Pool_Log"; private bool _isInitialized = false; public WinEventLog() : base() { Initialize(); } public void LogMessage(MessageLevel level

log4Net eventlog permissions issue using non-administrator account

放肆的年华 提交于 2019-12-10 13:47:13
问题 This probably isnt an issue with SiteCore per se but I've included it for completeness. I have sitecore 6.3 running under IIS7 using a custom identity for the app pool. I cant get Sitecore to write its logging information (using the default log4net settings) to the eventlog. I've followed the advice here: http://logging.apache.org/log4net/release/faq.html#Why%20doesn%27t%20the%20EventLogAppender%20work? and although it works fine when I make the custom identity a member of the administrator's

Can I list all registered event sources?

て烟熏妆下的殇ゞ 提交于 2019-12-10 12:34:34
问题 My windows service writes to the event log, but I've had various problems getting this correct. So in the process I used a number of different names. I followed an article describing how to set up event logs in windows services. So after adding an EventLog component in the designer, I have added this to the constructor: if (!System.Diagnostics.EventLog.SourceExists("AS0604")) System.Diagnostics.EventLog.CreateEventSource("AS0604", "SIRR"); eventLog1.Source = "AS0604"; eventLog1.Log = "SIRR";

How to retrieve event log other than Application category?

泄露秘密 提交于 2019-12-10 11:13:55
问题 I'm trying to retrieve some event log in a category that is different from Application. For example, I want to get the info in "Microsoft-Windows-Application Server-Applications/Operational". Below it is my code EventLog log = new EventLog("Microsoft-Windows-Application Server-Applications/Operational"); int index = log.Entries.Count - 1; Debug.WriteLine(log.Entries[index].Message); But it always shows the error: The event log 'Microsoft-Windows-Application Server-Applications/Operational' on

Custom value for the Event Log source property for ASP.NET errors

a 夏天 提交于 2019-12-09 13:36:55
问题 By default, ASP.NET records all uncaught exceptions to system Event Log. I’m aware of the fact that one should have a proper logging facility in place, but this is better than nothing and it serves well as a temporary solution. I would like to be able to filter efficiently the events in the log. I learned that, when logging programmatically, you can set a custom value for the Source column in the event log via: EventLog eventLog = new EventLog("Application"); eventLog.Source = "My custom name

NLog: can't write to event log

十年热恋 提交于 2019-12-08 23:27:07
问题 I can't write to the event log with NLog. I've been able to write to the console and to a file. I've turned on exceptions in NLog and am receiving no feedback from NLog. Here is my NLog.config: <?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true"> <targets> <target name="console" xsi:type="Console" layout="${message}" /> <target xsi:type="EventLog" name="eventlog" layout=

How can i write to the windows event log using C# (I'm getting some kind of error)?

…衆ロ難τιáo~ 提交于 2019-12-08 04:20:03
问题 I have written: . . . //Log exception to the event log if (!EventLog.SourceExists("PodaHIS")) { EventLog.CreateEventSource("PodaHIS", "Application"); } EventLog eventLog = new EventLog(); eventLog.Log = "Application"; eventLog.Source = "PodaHIS"; eventLog.WriteEntry(error.ToString(), EventLogEntryType.Error); I have also enabled read permission to LOCALMACHINE\ASPNET. And in return i get: The source was not found, but some or all event logs could not be searched. Inaccesible logs: Security.