怎么样才能写一个properites文件! 能把日志写到两个不同的文件里去

解决方案 »

  1.   

    import java.util.Properties;
    import java.io.*;
    public class test{

    public static void main(String[] args) {

    try {
    Properties pro=new Properties();
    FileOutputStream output=new FileOutputStream("d:\\1.properties");
    FileOutputStream output2=new FileOutputStream("d:\\2.properties");
    pro.setProperty("aaa", "aaaa");
    pro.setProperty("bbb", "bbbb");

    pro.store(output, "aaa");
    pro.store(output2, "b");

    output2.close();
    output.close();

    } catch (Exception e) {
    // TODO: handle exception
    System.out.println(e.getMessage());
    }

    }
    }
      

  2.   

    log4j.appender.FILEA=org.apache.log4j.RollingFileAppender
    这里继续添加对FILEA的定义log4j.appender.FILEB=org.apache.log4j.RollingFileAppender
    这里继续添加对FILEB的定义
    log4j.logger.com.you=FILEA,FILEB