Eventlog problems

Discussion in 'ASP .Net Web Services' started by Richard Heesbeen, Jun 8, 2005.

  1. Hi All,

    I'm writing an webservice and want to log errors etc. and thoughed the
    Eventlog would be a nice place for it. The problem is that i can't seem to
    write to my own log and source i'm getting ' Requested registry access is
    not allowed ' i have set the asp.net account to have permission on the
    registry entries but that doesn't help a bit. Writing to the Application log
    with my own source works just fine. But i want my own log so not to flood
    the Applications one!

    what can i do about that? any suggestions?

    Hopes someone can help me out,
    Richard.
    Richard Heesbeen, Jun 8, 2005
    #1
    1. Advertising

  2. Richard Heesbeen

    Brock Allen Guest

    When you try to write to an event log application that's not been registered,
    the API tries to create the approproate registry entry. The ASP.NET worker
    process identity doesn't have permissions to do that. You need to call EventLog.CreateEventSource
    from an administrative account first.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hi All,
    >
    > I'm writing an webservice and want to log errors etc. and thoughed the
    > Eventlog would be a nice place for it. The problem is that i can't
    > seem to write to my own log and source i'm getting ' Requested
    > registry access is not allowed ' i have set the asp.net account to
    > have permission on the registry entries but that doesn't help a bit.
    > Writing to the Application log with my own source works just fine. But
    > i want my own log so not to flood the Applications one!
    >
    > what can i do about that? any suggestions?
    >
    > Hopes someone can help me out,
    > Richard.
    Brock Allen, Jun 8, 2005
    #2
    1. Advertising

  3. Richard Heesbeen

    Steve Guest

    Hi Richard,

    Are you using System.Diagnostics? If not....

    Try using the System.Diagnostics event log handlers to output to an Event
    log. This should allow you to either specify an existing log to write to or
    create a new one, and also will give you listeners etc. to manipulate output
    tp the logs.

    HTH,
    Steve.


    "Richard Heesbeen" wrote:

    > Hi All,
    >
    > I'm writing an webservice and want to log errors etc. and thoughed the
    > Eventlog would be a nice place for it. The problem is that i can't seem to
    > write to my own log and source i'm getting ' Requested registry access is
    > not allowed ' i have set the asp.net account to have permission on the
    > registry entries but that doesn't help a bit. Writing to the Application log
    > with my own source works just fine. But i want my own log so not to flood
    > the Applications one!
    >
    > what can i do about that? any suggestions?
    >
    > Hopes someone can help me out,
    > Richard.
    >
    >
    >
    Steve, Jun 9, 2005
    #3
  4. Hi Brock,

    Thanks for your time,

    I have created the entries in an installer class with CreateEventSource
    like:

    EventLog.CreateEventSource ( "MyLog", "MyLog" );

    So the entries in the registry are there, but when i try to write to them in
    the webservice with:

    EventLog Log = new EventLog();
    Log.Log = "MyLog";
    Log.Source = "MyLog";
    Log.WriteEntry ( ... );

    Then i get the Exception, doing that in the installer works just fine, also
    to my own source in the Application log works fine.

    Any more suggestions?
    Richard.

    "Brock Allen" <> schreef in bericht
    news:...
    > When you try to write to an event log application that's not been
    > registered, the API tries to create the approproate registry entry. The
    > ASP.NET worker process identity doesn't have permissions to do that. You
    > need to call EventLog.CreateEventSource from an administrative account
    > first.
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    >> Hi All,
    >>
    >> I'm writing an webservice and want to log errors etc. and thoughed the
    >> Eventlog would be a nice place for it. The problem is that i can't
    >> seem to write to my own log and source i'm getting ' Requested
    >> registry access is not allowed ' i have set the asp.net account to
    >> have permission on the registry entries but that doesn't help a bit.
    >> Writing to the Application log with my own source works just fine. But
    >> i want my own log so not to flood the Applications one!
    >>
    >> what can i do about that? any suggestions?
    >>
    >> Hopes someone can help me out,
    >> Richard.

    >
    >
    >
    Richard Heesbeen, Jun 9, 2005
    #4
  5. Hi Steve,

    Thanks for your time,

    I use the following code in the webservice:

    using System.Diagnostics;

    EventLog Log = new EventLog();
    Log.Log = "MyLog";
    Log.Source = "MyLog";
    Log.WriteEntry ( ... );

    Is this ok? Or i'm i doing something wrong here?

    Richard.

    "Steve" <> schreef in bericht
    news:...
    > Hi Richard,
    >
    > Are you using System.Diagnostics? If not....
    >
    > Try using the System.Diagnostics event log handlers to output to an Event
    > log. This should allow you to either specify an existing log to write to
    > or
    > create a new one, and also will give you listeners etc. to manipulate
    > output
    > tp the logs.
    >
    > HTH,
    > Steve.
    >
    >
    > "Richard Heesbeen" wrote:
    >
    >> Hi All,
    >>
    >> I'm writing an webservice and want to log errors etc. and thoughed the
    >> Eventlog would be a nice place for it. The problem is that i can't seem
    >> to
    >> write to my own log and source i'm getting ' Requested registry access is
    >> not allowed ' i have set the asp.net account to have permission on the
    >> registry entries but that doesn't help a bit. Writing to the Application
    >> log
    >> with my own source works just fine. But i want my own log so not to flood
    >> the Applications one!
    >>
    >> what can i do about that? any suggestions?
    >>
    >> Hopes someone can help me out,
    >> Richard.
    >>
    >>
    >>
    Richard Heesbeen, Jun 9, 2005
    #5
  6. Richard Heesbeen

    Brock Allen Guest

    What exception are you getting now?

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hi Brock,
    >
    > Thanks for your time,
    >
    > I have created the entries in an installer class with
    > CreateEventSource like:
    >
    > EventLog.CreateEventSource ( "MyLog", "MyLog" );
    >
    > So the entries in the registry are there, but when i try to write to
    > them in the webservice with:
    >
    > EventLog Log = new EventLog();
    > Log.Log = "MyLog";
    > Log.Source = "MyLog";
    > Log.WriteEntry ( ... );
    > Then i get the Exception, doing that in the installer works just fine,
    > also to my own source in the Application log works fine.
    >
    > Any more suggestions?
    > Richard.
    > "Brock Allen" <> schreef in bericht
    > news:...
    >
    >> When you try to write to an event log application that's not been
    >> registered, the API tries to create the approproate registry entry.
    >> The ASP.NET worker process identity doesn't have permissions to do
    >> that. You need to call EventLog.CreateEventSource from an
    >> administrative account first.
    >>
    >> -Brock
    >> DevelopMentor
    >> http://staff.develop.com/ballen
    >>> Hi All,
    >>>
    >>> I'm writing an webservice and want to log errors etc. and thoughed
    >>> the Eventlog would be a nice place for it. The problem is that i
    >>> can't seem to write to my own log and source i'm getting ' Requested
    >>> registry access is not allowed ' i have set the asp.net account to
    >>> have permission on the registry entries but that doesn't help a bit.
    >>> Writing to the Application log with my own source works just fine.
    >>> But i want my own log so not to flood the Applications one!
    >>>
    >>> what can i do about that? any suggestions?
    >>>
    >>> Hopes someone can help me out,
    >>> Richard.
    Brock Allen, Jun 9, 2005
    #6
  7. I figured it out, a source name needs to be unique, may not exist in any
    other log.

    Thanks for your time,
    Richard.

    "Brock Allen" <> schreef in bericht
    news:...
    > What exception are you getting now?
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    >> Hi Brock,
    >>
    >> Thanks for your time,
    >>
    >> I have created the entries in an installer class with
    >> CreateEventSource like:
    >>
    >> EventLog.CreateEventSource ( "MyLog", "MyLog" );
    >>
    >> So the entries in the registry are there, but when i try to write to
    >> them in the webservice with:
    >>
    >> EventLog Log = new EventLog();
    >> Log.Log = "MyLog";
    >> Log.Source = "MyLog";
    >> Log.WriteEntry ( ... );
    >> Then i get the Exception, doing that in the installer works just fine,
    >> also to my own source in the Application log works fine.
    >>
    >> Any more suggestions?
    >> Richard.
    >> "Brock Allen" <> schreef in bericht
    >> news:...
    >>
    >>> When you try to write to an event log application that's not been
    >>> registered, the API tries to create the approproate registry entry.
    >>> The ASP.NET worker process identity doesn't have permissions to do
    >>> that. You need to call EventLog.CreateEventSource from an
    >>> administrative account first.
    >>>
    >>> -Brock
    >>> DevelopMentor
    >>> http://staff.develop.com/ballen
    >>>> Hi All,
    >>>>
    >>>> I'm writing an webservice and want to log errors etc. and thoughed
    >>>> the Eventlog would be a nice place for it. The problem is that i
    >>>> can't seem to write to my own log and source i'm getting ' Requested
    >>>> registry access is not allowed ' i have set the asp.net account to
    >>>> have permission on the registry entries but that doesn't help a bit.
    >>>> Writing to the Application log with my own source works just fine.
    >>>> But i want my own log so not to flood the Applications one!
    >>>>
    >>>> what can i do about that? any suggestions?
    >>>>
    >>>> Hopes someone can help me out,
    >>>> Richard.

    >
    >
    >
    Richard Heesbeen, Jun 13, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joe
    Replies:
    1
    Views:
    563
    Thomas Kratz
    Sep 29, 2003
  2. omoore

    Writing to Windows EventLog

    omoore, Aug 20, 2004, in forum: Perl
    Replies:
    0
    Views:
    510
    omoore
    Aug 20, 2004
  3. Eric Johannsen

    Trouble writing to EventLog

    Eric Johannsen, Aug 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    353
    Eric Johannsen
    Aug 10, 2003
  4. Larry Bates

    NT Services and EventLog problems

    Larry Bates, Mar 1, 2004, in forum: Python
    Replies:
    1
    Views:
    303
    F. Petitjean
    Mar 2, 2004
  5. Pieter Claerhout

    RE: NT Services and EventLog problems

    Pieter Claerhout, Mar 2, 2004, in forum: Python
    Replies:
    1
    Views:
    448
    Larry Bates
    Mar 2, 2004
Loading...

Share This Page