I have several applications running on a jboss server. I want to use separate log files for each application and have them placed in the same folder as the jboss server.log file. Currently the server.log file is placed here:

/usr/src/jboss/server/my_server/log/

However, when I use the below code, my applications' log files end up in:

/usr/src/jboss/bin/usr/src/jboss/server/my_server/log/

Anyone have any idea why?

Java Code:
    public static void addCustomAppender(String logId) throws IOException {
        String logName = logId;

	//Make sure the logger has not already been added.
        Logger rootLogger = Logger.getRootLogger();
        if (rootLogger.getAppender(logId) != null)
            return;

	//Get the FILE appender to find the location of our server.log file.
        Appender fileAppender = rootLogger.getAppender("FILE");
        if (fileAppender != null) {
            String logFolder = ((RollingFileAppender)fileAppender).getFile();
            logFolder = logFolder.substring(1, logFolder.lastIndexOf(File.pathSeparator));
            logName = logFolder + File.pathSeparator + logId + ".log";
        }

	//Create the RollingFileAppender.
        PatternLayout layout = new PatternLayout();
	layout.setConversionPattern("%d %-5p [%c] %m%n");
        RollingFileAppender myAppender = new RollingFileAppender(layout, logName);
        myAppender.setAppend(true);
        myAppender.setMaxFileSize("5MB");
        myAppender.setMaxBackupIndex(3);
        myAppender.setName(logId);

	//Add the appender.
        rootLogger.addAppender(myAppender);
    }
Here is the definition of the FILE appender from log4j.xml:

Java Code:
    <!-- A size based file rolling appender -->
    <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
        <!-- <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/> -->
        <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
        <param name="Append" value="false"/>
        <param name="MaxFileSize" value="10MB"/>
        <param name="MaxBackupIndex" value="5"/>
   
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
        </layout>	    
    </appender>