Search code examples
logginglog4jweblogic

Why location of log File specified in File appender is not being changed?


I am using log4j.xml in weblogic. I have specified path in the file param of FileAppender as shown below:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<log4j:configuration >
    <appender name="file1" class="org.apache.log4j.FileAppender">
        <param name="file" value="D:\ReadText_File\info.txt" />
        <param name="append" value="true" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1}]- %l - %m%n"/>
            </layout>
       <filter class="org.apache.log4j.varia.LevelMatchFilter">
            <param name="LevelToMatch" value="INFO"/>
            <param name="AcceptOnMatch" value="true"/>
        </filter>    
        <filter class="org.apache.log4j.varia.DenyAllFilter"/>
    </appender>

    <logger name="Client.class" additivity="false">
        <appender-ref ref="file1" />
    </logger>

    <root>
        <priority value="info" />
        <appender-ref ref="file1" />
    </root>

</log4j:configuration>

Now as you can see I have given a path for creating a log file; so instead of creating file in
ReadText_File folder, It creates the desired file in wls12120\user_projects\domains\mydomain\ and named it ReadText_Fileinfo.txt


Solution

  • A very small thing leaded to all this crap;
    Just tried using forward slash "/" instead of back slash "\" in the path; that's it!
    and everything's working perfectly now.