It didn't work. Any ideas , here is my code:
Windows .cmd file:
set LOG4J_NULL=nul
log4j.properties file
log4j.appender.LOGFILE.File=${LOG4J_NULL}
Douglas E Wegscheid wrote:
>
> if you set -DLOG4J_NULL=/dev/null in the unix shell script, and set
> -DLOG4J_NULL=nul in the Windows command file, then you can just say:
>
> log4j.appender.R.File=${LOG4J_NULL}
>
> in your log4j.properties, and it will work in both cases (assuming you use
> the correct appender name, and not the one I just wrote!). See the top of
> the javadocs for PropertyConfigurator.
>
> Property substitution is also supported in the DomConfigurator, see
> http://mail-archives.apache.org/mod_mbox/logging-log4j-dev/200105.mbox/%[email protected]%3e
> for a good example.
>
> Douglas E Wegscheid
> Lead Technical Analyst, Whirlpool Corporation
> (269)-923-5278
>
> "A wrong note played hesitatingly is a wrong note. A wrong note played
> with conviction is interpretation."
>
>
>
>
>
> power97 <[email protected]>
> 05/20/2009 11:11 AM
> Please respond to
> "Log4J Users List" <[email protected]>
>
>
> To
> [email protected]
> cc
>
> Subject
> RE: Dynamic File Name and Turn off File Logging
>
>
>
>
>
>
>
> I'm setting it right in the log4j.properties file. I'm thinking it won't
> be a
> big deal to just move the log4j outside the JAR file and change it when on
> Unix.
>
> Even if I set the value in batch script on windows and unix I still have
> to
> manually set the values so setting it in the log4j.properties maybe isn't
> anymore work.
>
>
>
> Douglas E Wegscheid wrote:
>>
>> how are you setting it now? inside your program, or in the
> configuration?
>>
>> you have a number of options: programmatically you can determine what OS
>
>> you are on and set it accordingly. You can set it appropriately as a
>> system property from whatever script or batch file you are invoking the
>> program from ( set -DLOG4J_NULL=/dev/null and the ${LOG4J_NULL} in your
>> config.
>>
>> options limited by imagination...
>>
>> Douglas E Wegscheid
>> Lead Technical Analyst, Whirlpool Corporation
>> (269)-923-5278
>>
>> "A wrong note played hesitatingly is a wrong note. A wrong note played
>> with conviction is interpretation."
>>
>>
>>
>>
>>
>> power97 <[email protected]>
>> 05/20/2009 10:25 AM
>> Please respond to
>> "Log4J Users List" <[email protected]>
>>
>>
>> To
>> [email protected]
>> cc
>>
>> Subject
>> RE: Dynamic File Name and Turn off File Logging
>>
>>
>>
>>
>>
>>
>>
>> How do I do that ? It does need to run on Windows and Unix.
>>
>>
>>
>> Michael Erskine wrote:
>>>
>>>> This works fine in Windows
>>>> but when run on Unix it actually creates a file called "nul".
>>>
>>> That's because what you're doing is Windows specific. Fix that if you
>> need
>>> a cross-platform configuration.
>>>
>>> Regards,
>>> Michael Erskine
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>>
> http://www.nabble.com/Dynamic-File-Name-and-Turn-off-File-Logging-tp23635686p23636539.html
>
>>
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Dynamic-File-Name-and-Turn-off-File-Logging-tp23635686p23637185.html
>
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
>
--
View this message in context:
http://www.nabble.com/Dynamic-File-Name-and-Turn-off-File-Logging-tp23635686p23641601.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]