1 55 package org.apache.log.output; 56 57 import java.io.File ; 58 import java.io.FileWriter ; 59 import java.io.IOException ; 60 61 68 public class FileOutputLogTarget 69 extends DefaultOutputLogTarget 70 { 71 private boolean m_append = false; 72 73 public FileOutputLogTarget() 74 { 75 } 76 77 public FileOutputLogTarget( final String filename ) 78 throws IOException 79 { 80 setFilename( filename ); 81 } 82 83 public FileOutputLogTarget( final String filename, final boolean append ) 84 throws IOException 85 { 86 m_append = append; 87 setFilename( filename ); 88 } 89 90 public void setAppend( final boolean append ) 91 { 92 m_append = append; 93 } 94 95 103 public void setFilename( final String filename ) 104 throws IOException 105 { 106 final File file = new File ( filename ); 107 final File parent = file.getAbsoluteFile().getParentFile(); 108 if( !parent.exists() ) parent.mkdirs(); 109 110 m_output = new FileWriter ( filename, m_append ); 111 } 112 } 113 | Popular Tags |