* Do not cast error/fatal messages to stderr in addition to log file. This may be nice in a
development/debug setup, but it may be deadly in a deployment scenario. * Fix Indentation for Gzipper class. * Some minor code style fixes as proposed by Intellij.
This commit is contained in:
parent
c3cd2be291
commit
2cea688e10
1 changed files with 44 additions and 68 deletions
|
@ -99,6 +99,7 @@ public class FileLogger extends Logger implements Log {
|
||||||
try {
|
try {
|
||||||
writer.close();
|
writer.close();
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ignore) {
|
||||||
|
// ignore
|
||||||
} finally {
|
} finally {
|
||||||
writer = null;
|
writer = null;
|
||||||
}
|
}
|
||||||
|
@ -228,31 +229,6 @@ public class FileLogger extends Logger implements Log {
|
||||||
return Logging.nextMidnight() - 86400000;
|
return Logging.nextMidnight() - 86400000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// override error() and fatal() to print error and fatal messages
|
|
||||||
// to the console, in addition to logging them to file.
|
|
||||||
|
|
||||||
public void error(Object parm1) {
|
|
||||||
System.err.println("Error: "+parm1);
|
|
||||||
super.error(parm1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void error(Object parm1, Throwable parm2) {
|
|
||||||
System.err.println("Error: "+parm1);
|
|
||||||
System.err.println("See "+logfile+" for stack trace");
|
|
||||||
super.error(parm1, parm2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void fatal(Object parm1) {
|
|
||||||
System.err.println("Fatal: "+parm1);
|
|
||||||
super.fatal(parm1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void fatal(Object parm1, Throwable parm2) {
|
|
||||||
System.err.println("Fatal: "+parm1);
|
|
||||||
System.err.println("See "+logfile+" for stack trace");
|
|
||||||
super.fatal(parm1, parm2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a Thread class that zips up a file, filename will stay the same.
|
* a Thread class that zips up a file, filename will stay the same.
|
||||||
*/
|
*/
|
||||||
|
@ -282,7 +258,7 @@ public class FileLogger extends Logger implements Log {
|
||||||
GZIPOutputStream zip = new GZIPOutputStream(new FileOutputStream(zipped));
|
GZIPOutputStream zip = new GZIPOutputStream(new FileOutputStream(zipped));
|
||||||
BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
|
BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
|
||||||
byte[] b = new byte[BUFFER_SIZE];
|
byte[] b = new byte[BUFFER_SIZE];
|
||||||
int len = 0;
|
int len;
|
||||||
|
|
||||||
while ((len = in.read(b, 0, BUFFER_SIZE)) != -1) {
|
while ((len = in.read(b, 0, BUFFER_SIZE)) != -1) {
|
||||||
zip.write(b, 0, len);
|
zip.write(b, 0, len);
|
||||||
|
|
Loading…
Add table
Reference in a new issue