Results 1 to 4 of 4

Thread: Newbie question on logging,

  1. #1
    Join Date
    Feb 2007
    Posts
    12

    Default Newbie question on logging,

    Hi,

    I'm trying to use windows service spring project, I compiled the example Echo and all work successfully, now I'm trying to made a class of mine working.

    I deploy the file in service directory, all xml files seems to be correct but the Start method of the class did not get executed. The problem is that I've no clue in what is wrong, my question is, is there is the possibilty to enable some form of logging in Spring.Services.WindowsService.Process.exe. Config file seems to have log4net correctly configured but no logfile is generated.

    Thanks for the attenction.

    Alk.

  2. #2
    Join Date
    Jan 2007
    Location
    Greenville, SC
    Posts
    13

    Default

    I've worked with Windows services a little, though I haven't done a Windows service with Spring yet. If the Start method is never executed, it sounds like the service is never starting. (OK, that sounded dumb, but I think you know what I'm trying to say.)

    Your Application event log should show when the Start signal is sent to the service, as well as whether the service started successfully or failed.

    I assume you are calling your startup code from the OnStart method of the service, right?

    I'm just trying to rule out some common problems before we narrow it down to a Spring issue where I will defer to the Spring experts. I have found it helpful to put my code in a Windows Forms app for testing and debugging so I can step through the code when needed. One caveat: If you use a Timer, you have to use the Windows.Forms.Timer for Windows apps, and the System.Timers.Timer for Windows services.

    Best wishes,
    Wesley

  3. #3
    Join Date
    Feb 2007
    Posts
    12

    Question

    The problem is an error on app.config, but my problem is that I was not really able to enable log for spring . Since app.config was wrong no start method is called, I tried to attach to the service, but the error is swallowed somewhere, so after a few try I decide to create an exe that will launch my class to see the error and I solved in a few minuter.

    I'm still wondering because even if I enable the log into the service config no logfile is generated.

    Alk.

  4. #4
    Join Date
    Jan 2006
    Location
    Cambridge, UK
    Posts
    1,340

    Default

    Hi,

    in case you are using log4net, you can trace logging problems by enabling the debug flag in your log4net configuration:

    Code:
    <log4net debug="true">
      ...
    </log4net>
    This will cause log4net to output additional information about itself by using System.Diagostics.Trace that can best be viewed using the tool "DebugView" from http://www.sysinternals.com

    For more information on configuring logging with spring, see our reference documentation's Common Logging section.

    hope this helps,
    Erich

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •