473,395 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Writing to the Eventlog

Hi,

I want to write events to the Apllication log and I'm trying to create
a custom source. When I run the app I get "The source was not found,
but some or all event logs could not be searched. Inaccessible logs:
Security.",
which is pretty normal, as users don't have rights to read/write the
Security log. But all I want to do is be able to create custom sources
an write them to the Application log.

Any ideas?

Greetings,

Mario
The Netherlands

Jul 2 '07 #1
4 12849
<mc*********@interpolis.nlwrote in message
news:11**********************@57g2000hsv.googlegro ups.com...
I want to write events to the Apllication log and I'm trying to create
a custom source. When I run the app I get "The source was not found,
but some or all event logs could not be searched. Inaccessible logs:
Security.",
which is pretty normal, as users don't have rights to read/write the
Security log. But all I want to do is be able to create custom sources
an write them to the Application log.
You create the event source with "CreateEventSource":

if(!EventLog.SourceExists("MySource")){
EventLog.CreateEventSource("MySource", "MyLog");
}

But notice that the code needs to be running whith administrative rights to
create the eventsource. Once it is created, ordinary users can write events
using this source.

See also http://support.microsoft.com/kb/842795
Jul 2 '07 #2
I'm not sure if this is the same or a different problem, but we get
something similar when we try to write to a non-existent log from, say, a
Web service. The problem is that the Web service default user does not have
permission to create logs. It does, however, have permission to write to
pre-existing application logs, so our workaround is to create the custom log
by hand (we've written a little application to do it). The application then
writes to it with no problem.

HTH
Peter

<mc*********@interpolis.nlwrote in message
news:11**********************@57g2000hsv.googlegro ups.com...
Hi,

I want to write events to the Apllication log and I'm trying to create
a custom source. When I run the app I get "The source was not found,
but some or all event logs could not be searched. Inaccessible logs:
Security.",
which is pretty normal, as users don't have rights to read/write the
Security log. But all I want to do is be able to create custom sources
an write them to the Application log.

Any ideas?

Greetings,

Mario
The Netherlands

Jul 2 '07 #3
On 2 Jul, 12:07, "Peter Bradley" <pbrad...@uwic.ac.ukwrote:
I'm not sure if this is the same or a different problem, but we get
something similar when we try to write to a non-existent log from, say, a
Web service. The problem is that the Web service default user does not have
permission to create logs. It does, however, have permission to write to
pre-existing application logs, so our workaround is to create the custom log
by hand (we've written a little application to do it). The application then
writes to it with no problem.

HTH

Peter

<mcw.will...@interpolis.nlwrote in message

news:11**********************@57g2000hsv.googlegro ups.com...
Hi,
I want to write events to the Apllication log and I'm trying to create
a custom source. When I run the app I get "The source was not found,
but some or all event logs could not be searched. Inaccessible logs:
Security.",
which is pretty normal, as users don't have rights to read/write the
Security log. But all I want to do is be able to create custom sources
an write them to the Application log.
Any ideas?
Greetings,
Mario
The Netherlands- Hide quoted text -

- Show quoted text -
Ok,

what I think the problem is, is when you check if a source exists,
e.g. if(!EventLog.SourceExists("MySource")), the security log is also
being searched, and a regular user does not have the rights to browse
through the security log. What I did is the same as Peter did, just
create the custom source by hand and then the app can write to this
source with no problem.

Greetings,

Mario

Jul 3 '07 #4
mc*********@interpolis.nl wrote:
Hi,

I want to write events to the Apllication log and I'm trying to create
a custom source. When I run the app I get "The source was not found,
but some or all event logs could not be searched. Inaccessible logs:
Security.",
which is pretty normal, as users don't have rights to read/write the
Security log. But all I want to do is be able to create custom sources
an write them to the Application log.

Any ideas?

Greetings,

Mario
The Netherlands
If you have an installer, you could add some code to create the custom
source during installation, since you generally need admin rights to
install software. That way the user will not have the security issue
when trying to create the source
Jul 3 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jacob Colding | last post by:
Hello, I have created a a logging mechanism, that writes mesages to a custom event log. On each check it verifies whether the requested source is registered to the "IPS" log. If not, it changes...
2
by: Scott Vercuski | last post by:
Everyone, I'm having trouble writing an event to the event log. Here is the chunk of code I currently have. ----------------------------------------------------------------------- Private...
5
by: David Conorozzo | last post by:
I am able to create new sources using CreateEventSource. I can call GetEventLogs, I can delete sources, I can see if sources exist BUT, as soon as I try a "WriteEntry", I get an exception: ...
2
by: Marauderz | last post by:
OK this just seems to be a common question being asked around here, I've tried Google Grouping the question but I still haven't came up with a solution yet. So here goes... I'm getting the...
6
by: MattC | last post by:
I have some code that correctly writes to the eventlog on my local machine. I have installed the application on the Live server and all is not well, no event log entries. My development box...
2
by: MattB | last post by:
I'm writing some code to log errors in a web app (vb/asp.net). I found a straightforward-looking example here: http://www.c-sharpcorner.com/Code/2002/May/CustomErrorHandlingASPNEt.asp But mine...
0
by: Karthik Srinivasan | last post by:
Hi, My web application which runs on Windows 2003 server writes to EventLog during application startup but I get the following exception Requested registry access is not allowed. at...
9
by: Jerry C | last post by:
I am trying to write to the errorlog and I am getting the error Cannot open log for source 'Application'. You may not have write access. This is the code: Dim Logevent As New...
10
by: David Thielen | last post by:
Hi; I am trying to write to the event log using: public const string EVENT_LOG_NAME = "Windward Portal"; if (!EventLog.SourceExists(EVENT_LOG_NAME)) EventLog.CreateEventSource(EVENT_LOG_NAME,...
2
by: =?Utf-8?B?REo=?= | last post by:
I've created a new EventLog for mail services in my web application. Each time a mail is sent, it is recorded in the eventlog for later review. This works fine when I am on my development machine...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.