Skip to content

Instantly share code, notes, and snippets.

@bigtoast
Created May 8, 2013 17:48
Show Gist options
  • Save bigtoast/5542180 to your computer and use it in GitHub Desktop.
Save bigtoast/5542180 to your computer and use it in GitHub Desktop.
package com.ticketfly.pillage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
public class LogfileReporter implements StatsReporter {
private File logDirectory;
private String now = System.currentTimeMillis() + ".log";
private File logFile;
public LogfileReporter( String logDirectoryPath ) {
this(new File(logDirectoryPath));
}
public LogfileReporter( File logDirectory ) {
this.logDirectory = logDirectory;
this.logFile = new File(logDirectory.getAbsolutePath() + "/" + now);
}
@Override
public void report(StatsSummary stats) {
FileOutputStream out = null;
try {
out = new FileOutputStream(logFile, true);
FileChannel channel = out.getChannel();
} catch ( IOException ex ) {
} finally {
try {
if ( out != null )
out.close();
} catch ( IOException ex ) {
// do nothing
}
}
//To change body of implemented methods use File | Settings | File Templates.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment