You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by robert burrell donkin <ro...@blueyonder.co.uk> on 2006/02/01 23:25:11 UTC

[logging] anyone know an elegant way to switch on a system property using ant?

i've been playing around with ways to persuade ant to switch JCL
diagnostics on which means setting a system property. i know workarounds
(like defining a trivial task, for example) but i'm sure that there must
be an elegant way to do this which i just can't discover. since it's for
some documentation, i'd prefer to suggest users do it the right way.

anyone know?

- robert




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [logging] anyone know an elegant way to switch on a system property using ant?

Posted by Craig McClanahan <cr...@apache.org>.
On 2/1/06, robert burrell donkin <ro...@blueyonder.co.uk>
wrote:
>
> i've been playing around with ways to persuade ant to switch JCL
> diagnostics on which means setting a system property. i know workarounds
> (like defining a trivial task, for example) but i'm sure that there must
> be an elegant way to do this which i just can't discover. since it's for
> some documentation, i'd prefer to suggest users do it the right way.


Is this in the context of running some JUnit tests?  If so, the <junit> task
accepts nested <sysproperty> elements to set system properties that are
passed in to the executing tests.  (IIRC you also have to say fork="true"
for this to work, because you won't want to mess with the JVM that Ant
itself is running in).

Programmatically, of course, you can call System.setProperty() if your
security manager lets you (or if you're not running under a security
manager).

anyone know?
>
> - robert


Craig

---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>