Reverted to the old way of redirecting stderr and stdout. The try-resource method was closing the stream.
This commit is contained in:
parent
95899c2840
commit
398f4559cf
1 changed files with 6 additions and 5 deletions
|
@ -335,8 +335,9 @@ public class Mobibot extends PircBot {
|
||||||
|
|
||||||
// Redirect the stdout and stderr
|
// Redirect the stdout and stderr
|
||||||
if (!line.hasOption(Commands.DEBUG_ARG.charAt(0))) {
|
if (!line.hasOption(Commands.DEBUG_ARG.charAt(0))) {
|
||||||
try (final PrintStream stdout = new PrintStream(new FileOutputStream(
|
try {
|
||||||
logsDir + channel.substring(1) + '.' + Utils.today() + ".log", true))) {
|
final PrintStream stdout = new PrintStream(new FileOutputStream(
|
||||||
|
logsDir + channel.substring(1) + '.' + Utils.today() + ".log", true));
|
||||||
System.setOut(stdout);
|
System.setOut(stdout);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Unable to open output (stdout) log file.");
|
System.err.println("Unable to open output (stdout) log file.");
|
||||||
|
@ -344,9 +345,9 @@ public class Mobibot extends PircBot {
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
try (final PrintStream stderr = new PrintStream(
|
final PrintStream stderr = new PrintStream(
|
||||||
new FileOutputStream(logsDir + nickname + ".err", true))) {
|
new FileOutputStream(logsDir + nickname + ".err", true));
|
||||||
System.setErr(stderr);
|
System.setErr(stderr);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Unable to open error (stderr) log file.");
|
System.err.println("Unable to open error (stderr) log file.");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue