Setting Properties on the Command Line

2 min read

2 min read

2 min read

2 min read

2 min read

2 min read

2 min read

2 min read

2 min read

When you pass the command-line arguments of your program to communicator initialization, Ice sets a property for each argument of the form --name=value where name is the name of an Ice property, and removes this argument. For example:

Shell
./server --Ice.Trace.Network=3 --verbose

sets Ice.Trace.Network to 3, and --verbose remains for your application.

When the command line sets the same property more than once, the last one applies. An argument without =value sets the property to 1, and an argument with an empty value clears the property:

Shell
./server --Ice.Trace.Protocol # same as --Ice.Trace.Protocol=1
./server --Ice.Trace.Protocol= # clears Ice.Trace.Protocol

Ice validates these arguments like any other property: an argument whose name begins with a reserved prefix and a dot but is not the name of an Ice property, such as --Ice.Foo=1, makes communicator initialization fail.

Ice removes the arguments it converts into properties, and Creating a Communicator shows how each mapping returns the remaining arguments. Initialize the communicator before you parse these arguments, so that your application sees only the arguments meant for it.