Well, System properties are not the same as OS environment properties.  If you
want an OS environment property to exist in the JVM, you will have to set it
via the -D parameter on the command line, such as (on windows)....

java -Dlog.dir=%LOG_DIR% MyClass

Then, in your log4j.xml file...

<param name="File"
 value="${log.dir}/jboss/${jboss.server.name}/server.log"/>


Jake

Quoting Farzad Kohantorabi <[EMAIL PROTECTED]>:

> Jake,
>
> Thanks for your sharp response. What I need to do is to set a variable
> outside the Log4j.xml file and have all the log redirected to the path
> specified in that variable. By environment variable I meant what you set
> in you windows property window, like PATH and CLASS_PATH.
>
> Well, I have the following in my log4j.xml file:
>
> <param name="File"
> value="${LOG_DIR}/jboss/${jboss.server.name}/server.log"/>
>
> And I tried to set the LOG_DIR both in the windows properties window and
> -D java option but they didn't seem to work. Do you have any idea why?
>
> Farzad-
>
> -----Original Message-----
> From: Jacob Kjome [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 21, 2006 3:41 PM
> To: Log4J Users List
> Subject: Re: using variables in log4j xml file
>
>
> When you say "environment variables", do you mean System (JVM-wide)
> properties?
> If so, then you just reference them as ${mysyspropname}.  I imagine that
> JBoss
> sets some system properties and that is probably what you are seeing
> referenced
> in the log4j config files you speak of.  The example you provide where
> the
> property name is prefixed with "env" is invalid.  There's no specific
> "env"
> scope, or any scope for that matter, used by Log4j to resolve
> properties.
>
> Jake
>
> Quoting Farzad Kohantorabi <[EMAIL PROTECTED]>:
>
> > Hi group,
> >
> >
> >
> > I am not sure if it is the right place to ask this question but I have
> > seen usage of jboss variables in the log4j.xml file. However, I am
> > wondering if it is possible to use environment variables in the config
> > file, something like ${env.LOG_DIR}.
> >
> >
> >
> >
> >
> > Thanks,
> >
> > Farzad-
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to