Specifying the location of the log file in Websphere in a platform-independent manner

When using Log4J RollingFileAppenderin Websphere 7.0, how can I specify the location of the logging directory in the log4j.properties file, that is, select the Websphere variable LOG_ROOT?

+3
source share
2 answers

Of course, it would be trivial to simply write your own subclass of RollingFileAppender, which programmatically determines the value of the LOG_ROOT variable in a platform-independent way.

This probably only requires about a dozen lines of code. Then follow these steps:

    <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>

File, LOG_ROOT .

, ,

-gMale

+1

JVM Custom, WebSphere.

JVM Custom log4j.properties.

:

:

> a > a > Java >

Customer WebSphere - KeyForMyCustomProperty. WebSphere : ${}

, ${MY_VARIABLE}.

log4j

log4j.appender.messageAppender.File = ${KeyForMyCustomProperty}/Message.log

, . , WebSphere JVM, : WebSphere log4j.properties

Manglu

+4

Source: https://habr.com/ru/post/1763032/


All Articles