Hi,

thx for fast reply.

On 02.03.2010 15:54, Anthony Tuininga wrote:
> Hi,
>
> I'll give it some thought. I know I avoided the use of Windows event
> logs for a reason but I can't remember what that reason was. I'll see
> if I can refresh my memory! :-) In addition, logging to a file allows
> for errors to be reported earlier and with considerably greater detail
> than would be possible with event logs -- the event log system isn't
> always available whereas writing to a file is.

Yes you are right. But in the special case of a service, the event log
should be there. And logging to a file in this case is more critical because
the service runs with other user rights.
(locking problems, access denied ...)

> This is probably getting to your point about minimal documentation :-)
> but there is a solution for you.
>
> Specifically, you can pass a parameter to the service which is
> expected to be the associated INI file. If no name is specified it
> searches for<ExecutableName>.ini instead. Inside that INI file it
> looks for the following:
>
> [Logging]
> FileName=
> Level=
> Prefix=
> MaxFiles=
> MaxFileSize=
>
> There are defaults for these and these are what you are using.
> FileName=<ExecutableName>.log
> Level=ERROR
> Prefix=[%i] %d %d
> MaxFiles=1
> MaxFileSize=1 MB

I always use this for my own configuration file passing and it is one
of the features because I use cx_freeze. Other service libraries or
pywin32 doesn't support this style.

The problem is my configuration format is different to this one
used in cx_Logging. ;-)

It would also help if the service handler script knows the service name.
Now it looks like:

# called when the service is starting
   def Initialize(self, configFileName):

it could be:
# called when the service is starting
   def Initialize(self, serviceName, configFileName):

another global var with:
static char gServiceName[...];

But this is not essential. I can do this setting also into the config file.
This is only a thought of mine.


> See the documentation for cx_Logging for additional information.

I hopefully read every line.
(and the source code :-) )

> With that you should be able to specify where you want the file to go,
> how much information you would like in it and whether you want to keep
> a set of log files from previous invocations, etc.
>
> Hope that helps. I'll make sure that I add this information to my
> rather sparse documentation. :-) Thanks.

Thx, that would help others.


Thank you for your help.
If there is time I try to build a Service.exe of my own and share the code.


Wolfgang

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
cx-freeze-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cx-freeze-users

Reply via email to