Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat exception catch #701

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.security.smithloader.log;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.time.Instant;
import java.util.logging.FileHandler;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
Expand All @@ -14,9 +12,8 @@ public class SmithAgentLogger {
public static Logger logger = Logger.getLogger("RASPAgent");

static {
logger.setUseParentHandlers(false);

try {
logger.setUseParentHandlers(false);
String filename = String.format("/tmp/JVMAgent.%d.log", ProcessHelper.getCurrentPID());

FileHandler handler = new FileHandler(filename, 5 * 1024 * 1024, 5, true);
Expand All @@ -25,7 +22,7 @@ public class SmithAgentLogger {
SimpleFormatter formatter = new SimpleFormatter();
handler.setFormatter(formatter);

} catch (IOException | NumberFormatException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -30,7 +29,7 @@ public static void info() {
}
}
}
} catch (IOException e) {
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import com.security.smith.common.ProcessHelper;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.time.Instant;
import java.util.logging.FileHandler;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
Expand All @@ -16,9 +14,9 @@ public class SmithLogger {


public static void loggerProberInit() {
logger.setUseParentHandlers(false);


try {
logger.setUseParentHandlers(false);
String filename = String.format("/tmp/JVMProbe.%d.log", ProcessHelper.getCurrentPID());

fileHandler = new FileHandler(filename, 5 * 1024 * 1024, 5, true);
Expand All @@ -27,7 +25,7 @@ public static void loggerProberInit() {
SimpleFormatter formatter = new SimpleFormatter();
fileHandler.setFormatter(formatter);

} catch (IOException | NumberFormatException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
Expand Down
Loading