Archived

This forum has been archived. Please start a new discussion on GitHub.

Re-directing logging, in particular registry and node processes

Hi,

I am now further on with my grid and am installing grid and registry processes as Services using the iceserviceinstall.exe.

Everything works as expected and I can get a test grid running, however I cannot get the logging for the node and registry processes to re-direct.

I have included Ice.StdOut and Ice.StdErr properties in both config files:

Node:

Ice.StdOut=C:\ProViewGrid\logs\node.log
Ice.StdErr=C:\ProViewGrid\logs\node.err

Registry:

Ice.StdOut=C:\ProViewGrid\logs\registry.log
Ice.StdErr=C:\ProViewGrid\logs\registry.err

When I start the node and registry window Services These files are indeed created, but nothing is logged to them.

I'd be grateful if you'd let me know if I should configure this in another manner.

On a related Point I have ice box Services which instantiate components defined in a server-template. If I set the Ice.StdOut and Ice.StdErr as properties at the IceBox Level then I can re-direct my component Output to the specified files. However if I define These properties at the server-template Level it doesn't work. I suspect this is expected behaviour, but please let me know if there is a way of defining logging at the server-template Level as it would simplify my files a bit (this obviously isn't massively important...)

Comments

  • bernard
    bernard Jupiter, FL
    Hi Daniel,

    Ice.StdErr and Ice.StdOut redirect the standard err and out of your application; when you run an IceGrid registry (or node) as a service, the registry (or node) does not send anything to stderr or stdout, and as a result your .log and .err files are empty.

    When an IceGrid registry (or node) is not run as a service, it uses by the default the "default logger", which sends everything to standard err. If you redirect stderr to a file, you will capture this output. However, when you run this IceGrid registry as a service on Windows, the default logger is a special logger that writes all messages to the Windows event log. See Manually Installing a Service - Ice 3.5 - ZeroC for more details.

    If you'd rather send these log messages to a file, you can set Ice.LogFile=<path-to-file> in your registry or node configuration file. Make sure that the user who runs these services - by default LOCAL SERVICE - can write into this file.
    On a related Point I have ice box Services which instantiate components defined in a server-template. If I set the Ice.StdOut and Ice.StdErr as properties at the IceBox Level then I can re-direct my component Output to the specified files. However if I define These properties at the server-template Level it doesn't work. I suspect this is expected behaviour, but please let me know if there is a way of defining logging at the server-template Level as it would simplify my files a bit (this obviously isn't massively important...)

    Since these (IceBox) servers are started by your IceGrid node, you could simply use the IceGrid.Node.Output property of your node. With this approach, there is no need to set any property in your server or service descriptor.

    Please note that IceGrid offers server templates and service templates, but not icebox-server templates. A server template can only describe a plain server - not an icebox server. So I don't see how your IceBox server or service could instantiate a server template.

    Ice.StdOut and Ice.StdErr have naturally a process-wide effect, and they are used only by the first communicator created within a process. If this process is an IceBox server, the first communicator is the IceBox server itself; by default, each IceBox service loaded by this IceBox server will get its own communicator, and Ice.StdOut/Ice.StdErr have no effect on these "service" communicators. If you want to send the log a service to a special file, you need to set Ice.LogFile in the properties of this service.

    I hope it's all clear now!

    Best regards,
    Bernard
  • Hi Bernard,

    Many thanks for the detailed Explanation, it is indeed all clear now.

    I of course I meant "service-template", I typed up my post in a bit of a hurry hence the slip-up :-)

    Have a good Weekend !

    Daniel