event-log

(Windows) Exception Handling: to Event Log or to Database?

不问归期 提交于 2019-12-06 00:36:50
问题 I've worked in shops where I've implemented Exception Handling into the event log, and into a table in the database. Each have their merits, of which I can highlight a few based on my experience: Event Log Industry standard location for exceptions (+) Ease of logging (+) Can log database connection problems here (+) Can build report and viewing apps on top of the event log (+) Needs to be flushed every so often, if alot is reported there (-) Not as extensible as SQL logging [add custom fields

How do I specify events deep inside “Applications and Services Logs”?

感情迁移 提交于 2019-12-05 23:00:00
The following code snippet fires an event when an event is logged. The sample code works fine but the log I want to monitor is actually "Applications and Services Logs > Microsoft > Windows > Task Scheduler > Operational". What do I insert in place of "Application" in the code sample? ... EventLog myNewLog = new EventLog("Application", ".", "testEventLogEvent"); myNewLog.EntryWritten += new EntryWrittenEventHandler(MyOnEntryWritten); myNewLog.EnableRaisingEvents = true; ... The log name is Microsoft-Windows-TaskScheduler/Operational but I don't think you can access it using the EventLog class.

Where is the application dump created by Environment.FailFast() located on the disk?

谁都会走 提交于 2019-12-05 18:47:29
问题 I am trying to use Environment.FailFast() in my application. The MSDN documentation says that it creates an application dump during application termination. The FailFast method writes the message string to the Windows Application event log, creates a dump of your application , and then terminates the current process. The message string is also included in error reporting to Microsoft. Can someone direct me to the location where the dump is created? 回答1: I used the following code to reproduce

Get-EventLog - valid message missing for some event log sources

[亡魂溺海] 提交于 2019-12-05 10:27:30
I'm pulling and filtering System Event Log data using get-eventlog. What I'm finding is that get-event log is not able to correctly return the message associated with some entries. These entries appear normally in the event log viewer. E.g. get-eventlog -logname system | ? { $_.source -eq "Microsoft-Windows-Kernel-General" } returns 8 entries, all of which have a message of the following form: The description for Event ID '12' in Source 'Microsoft-Windows-Kernel-General' cannot be found. The local computer may not have the necessary registry information or message DLL files to display the

How to determine if an EventLog already exists

孤街醉人 提交于 2019-12-05 08:32:19
问题 I'm using the following line to create a new event log new-eventlog -LogName "Visual Studio Builds" -Source "Visual Studio" I want to run this every time, because if I run a build from a new computer, I'd still like to see the event logs. The problem is that every time the script is run after the log is already created, it throws an error. New-EventLog : The "Visual Studio" source is already registered on the "localhost" computer. At E:\Projects\MyApp\bootstrap.ps1:14 char:13 + new-eventlog <

Using “Microsoft Windows Security Auditing” provider in real-time consumer with ETW (Event Tracing for Windows)

喜欢而已 提交于 2019-12-05 07:25:30
My task is to make an ETW real-time consumer with events provided by 'Microsoft Windows Security Auditing'. I made a simple controller and consumer application, basing on this example http://msdn.microsoft.com/en-us/library/windows/desktop/ee441325%28v=vs.85%29.aspx and changing flags to work in real-time mode. The main function looks this way: LPTSTR SessionName = L"hahahaaa"; ULONG status = ERROR_SUCCESS; PEVENT_TRACE_PROPERTIES pSessionProperties = NULL; EVENT_TRACE_LOGFILE trace; TRACEHANDLE hTrace = 0; TRACEHANDLE hSession = 0; const GUID providerId = { 0x54849625, 0x5478, 0x4994, { 0xA5,

How to write event log using vbscript

不羁岁月 提交于 2019-12-05 02:19:04
问题 I want to write event log when this vbscript run. How to i can? Thanks for any help. 回答1: Like so: Set shell = CreateObject("WScript.Shell") shell.LogEvent 4, "Your Message Here" The 4 is a severity level. You can learn more about the LogEvent method on MSDN. 回答2: This is old but I'm sure still valid. http://msdn.microsoft.com/en-us/library/b4ce6by3 You also need permissions to be able to write to the event log so depending on the user running the script you may or my not have access. 回答3:

NT Eventlog single message size

随声附和 提交于 2019-12-05 01:12:41
Can anybody tell me what is maximum size of a windows NT log message? I know that it is possible to reset the maximum log size of event log from 32 MB. I am interested about the memory a single message can hold in NT event log. Thanks in advance In Windows Server 2008 the maximum size of a single Event Log entry is: 31,839 characters http://msdn.microsoft.com/EN-US/library/windows/desktop/aa363679.aspx The answer is 32766 characters ~ 32 KB See a example below: Error: Log entry string is too long. A string written to the event log cannot exceed 32766 characters. 来源: https://stackoverflow.com

C# EventLog Inaccessible Log

蓝咒 提交于 2019-12-05 00:18:13
Below is an exception I encountered while running the immediately following code: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security. The code is if (!EventLog.SourceExists(this.EventLogSource)) The content of the exception makes sense to me, it's why that doesn't. This line is running in Visual Studio 2010, .NET 4, as a console app ( for the time being ). I have run this in a different environment, but I wouldn't expect the fact that I'm remote desk'ed to break this method. I've tried changing HKML\CCS\Services\eventlog permissions - to no

Security exception when writting to an EventLog from an ASP.NET MVC application

南楼画角 提交于 2019-12-04 19:26:59
问题 I have a library that I created with some business logic that includes writing to a System.Diagnostics.EventLog instance. The library is normally called from a Windows Service application, but now I'm trying to call those same library functions from my ASP.NET MVC application. I tried this code inside my controller to create the EventLog instance that I pass into the method that needs to write to the log. Dim log = New EventLog("Application", My.Computer.Name, "MyMVCApp") The following error