JethroXT skrev  den 27-07-2008 19:16:
Hi,
I have a problem that maybe someone could solve:

I have a network consisting of several nodes that all have to log data
independently.
I don't know the exact number of nodes before runtime, so Loggers (or
appenders) have
to be created at runtime.

Is this at program start time or dynamically changing while running?

If it is at program start time you can set a system property which can then be expanded in the log4j.properties file. From PropertyConfigurator javadoc

"All option /values/ admit variable substitution. The syntax of variable substitution is similar to that of Unix shells. The string between an opening *"${"* and closing *"}"* is interpreted as a key. The value of the substituted variable can be defined as a system property or in the configuration file itself. The value of the key is first searched in the system properties, and if not found there, it is then searched in the configuration file being parsed. The corresponding value replaces the ${variableName} sequence. For example, if |java.home| system property is set to |/home/xyz|, then every occurrence of the sequence |${java.home}| will be interpreted as |/home/xyz|. "

Is this what you need?

--
 Thorbjørn

Reply via email to