简体   繁体   中英

Setting file path in log4j.xml

In log4j.xml at local, i am trying to set path as

<appender name="ERROR_FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="C:\\logs\\app_error.log" />
</appender>

it is working fine.

but for server, i need to create the log file under "/mainroot/projects/log". I am trying

<appender name="ERROR_FILE" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="File" value="\\mainroot\\projects\\log\\app_error.log" />
    </appender>

but this is not working. Plese help to set the path.

<appender name="ERROR_FILE" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="File" value="\\mainroot\\projects\\log\\app_error.log" />
    </appender>

Unix uses "/" as a path separator. Try this:

<appender name="ERROR_FILE" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="File" value="/mainroot/projects/log/app_error.log" />
    </appender>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM