When using a Log4J RollingFileAppender
on Websphere 7.0, how can I specify the location of the logging directory in the log4j.properties file, i.e. pick up Websphere's LOG_ROOT
variable?
Of course, it would be trivially simple to write a custom subclass of RollingFileAppender that programatically determines the LOG_ROOT variable value, in a platform-independent way.
It would likely only require about a dozen lines of code, if that. Then follow up with,
<appender name="CustomAppender" class="path.to.your.CustomAppender">
<param name="File" value="fileNameOnly.out" />
<param name="Append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m%n" />
</layout>
</appender>
and let the subclass accept the File parameter, derive the LOG_ROOT path, and append it to the file name before calling super class methods.
I hope that helps in some way,
-gMale