Relative paths for IceGrid.Node.Output are not relative to the Node

in Help Center
I'm building an application which will be installed (from an SVN) on different machines. As the install location will vary between machines I'm avoiding the use of absolute paths. As I control the directory structure and thus know the relative paths between the Nodes and the sub-directories which contain the Servers this hasn't proved a problem until I tried to use the IceGrid.Node.Output option (see snippet from config file below). To my surprise "IceGrid.Node.Output = logs" is interpreted relative the to Servers' working directories and not the Node's working directory (I'm using "pwd" when the servers are launched).
I would like to collect all the logs in one directory rather than relative to each Server. Is there something that I can put in the below configuration file to achieve that other than the absolute path? For example something tha expands to the absolute path at runtime, e.g. "IceGrid.Node.Output = `cwd` <this doesn't actually work>".
Thanks,
Paul
#
# IceGrid Node configuration.
# (co-located with registry)
#
IceGrid.Node.Endpoints = tcp
IceGrid.Node.Name = Node1
IceGrid.Node.Data = node # local directory name for node data storage
IceGrid.Node.Output = logs # local directory for output from this node's servers
# NB relative directory paths for Node.Output are interpreted relative to the server
IceGrid.Node.CollocateRegistry = 1
Ice.Default.Locator = IceGrid/Locator:tcp -p 4061
I would like to collect all the logs in one directory rather than relative to each Server. Is there something that I can put in the below configuration file to achieve that other than the absolute path? For example something tha expands to the absolute path at runtime, e.g. "IceGrid.Node.Output = `cwd` <this doesn't actually work>".
Thanks,
Paul
#
# IceGrid Node configuration.
# (co-located with registry)
#
IceGrid.Node.Endpoints = tcp
IceGrid.Node.Name = Node1
IceGrid.Node.Data = node # local directory name for node data storage
IceGrid.Node.Output = logs # local directory for output from this node's servers
# NB relative directory paths for Node.Output are interpreted relative to the server
IceGrid.Node.CollocateRegistry = 1
Ice.Default.Locator = IceGrid/Locator:tcp -p 4061
0
Comments
Welcome to our forums!
If you look at the configuration files generated by IceGrid, you'll see that all IceGrid.Node.Output does it trigger the creation of Ice.StdOut and Ice.StdErr settings in this configuration file. And a relative IceGrid.Node.Output path becomes a relative path for Ice.StdOut/Ice.StdErr.
I think the default working directory for a server is actually the working directory of the node that launches it, so by default, you could not tell the difference. Perhaps you're setting a non-default working directory for your servers?
A solution here could be to set Ice.StdOut and Ice.StdErr in your server configuration (IceGrid descriptors), using a variable such as ${node.datadir}:
Best regards,
Bernard
Thanks!
Yes, I'm using the 'pwd' option in <server ...>, in the IceGrid descriptor file, to change the working directory for each server.
Okay I'll look at your suggestion,
thanks,
Paul
I just realised how cunning your suggestion is. As you obviously knew ${node.datadir} is one of "special descriptor variables" which points to the "absolute pathname of the enclosing node's data directory". Thus getting an absolute path without the need to hard code it. Genius!
I've adapted your suggestion and used
which I think (haven't tested it yet) should give me exactly what I want.
Many thanks!
Paul
I've now got a problem with ${server} not being resolved when the application descriptor file is read. My application description looks something like:
I'm guessing this is due to scoping. But as ${node.datadir} is being resolved I'm not clear why ${server} isn't.
According to IceGrid Property Set Semantics:
Named property sets are evaluated at the point of definition. If you reference other property sets or use variables in a named property set definition, you must make sure that the referenced property sets or variables are defined in the same scope. For example, the following is correct:
However, the following example is wrong because the ${level} variable is not defined at the application scope:
If both the application and the node define the ${level} variable, the value of the ${level} variable in the DebugApp property set will be the value of the variable defined in the application descriptor.
So you shouldn't be able to use ${node.datadir} or ${server} in this application-level property set. Can you confirm ${node.datadir} is indeed resolved with your example? This could be a bug.
Thanks,
Bernard