package com.perforce.cvs.process; import java.io.BufferedOutputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.perforce.config.CFG; import com.perforce.config.Config; import com.perforce.config.ConfigException; public class TmpFileLogger { private static Logger logger = LoggerFactory.getLogger(TmpFileLogger.class); private static File auditFile; private static DataOutputStream out; static { try { String tmpDir = (String) Config.get(CFG.CVS_TMPDIR); auditFile = new File(tmpDir, "tmpFile.log"); File d = new File(tmpDir); if (!d.mkdirs()) { if (!d.exists()) { logger.error("Cannot create directory: " + d.getPath()); throw new RuntimeException(); } } } catch (ConfigException e) { logger.error("Cannot get Configuration", e); throw new RuntimeException(e); } try { // add file handler FileOutputStream fs = new FileOutputStream(auditFile, false); BufferedOutputStream bs = new BufferedOutputStream(fs); out = new DataOutputStream(bs); // add header out.writeBytes("# RCS file with expanded deltas\n"); out.flush(); } catch (Exception e) { logger.error("Cannot write to file: " + auditFile, e); throw new RuntimeException(e); } } public static void logRcsFile(File file) throws Exception { StringBuffer sb = new StringBuffer(); sb.append("\nRCS file: "); sb.append(file); sb.append("\n"); out.writeBytes(sb.toString()); out.flush(); } public static void logTmpFile(String file) throws Exception { StringBuffer sb = new StringBuffer(); sb.append("... "); sb.append(file); sb.append("\n"); out.writeBytes(sb.toString()); out.flush(); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 13876 | Paul Allen | Rename/move file(s) | ||
//guest/paul_allen/p4convert-maven/src/com/perforce/cvs/process/TmpFileLogger.java | |||||
#1 | 13873 | Paul Allen | Branching using p4convert-maven | ||
//guest/perforce_software/p4convert/src/com/perforce/cvs/process/TmpFileLogger.java | |||||
#1 | 12521 | Paul Allen |
CVS: Audit logging when generating Tmp files from RCS. Creates a file "tmpFile.log" under the com.perforce.cvs.tmpDir and logging is enabled by default. com.perforce.cvs.audit.tmp=true |