On Tue, Mar 2, 2010 at 8:42 AM, Wolfgang Langner <[email protected]> wrote: > Hi, > > thx for fast reply.
You're welcome. > 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 ...) Sure. I'm sure we can find good arguments for both sides. :-) What information would you want in the event log, though? I have found that reading the event log is tedious, especially if there are a lot of messages in it. For that, a file is far more convenient. >> 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. ;-) What is your format? I'm not particularly stuck on the one I have if you can give me a good reason to use yours. :-) > 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. Sure. That would change the signature of the Initialize() routine and would break any existing services. Perhaps setting the attribute directly on the object before calling Initialize() might work. I'll take a peek and see if this can be done easily. > Thank you for your help. > If there is time I try to build a Service.exe of my own and share the code. You're welcome. If you simply want to tweak the existing base executable I'd be happy to accept patches. For example, if you want to turn off support for cx_Logging and write to the event log, I'd be happy to accept those patches and provide a way of choosing between the two modes. Anthony ------------------------------------------------------------------------------ Download Intel® 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
