Skip to content
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
Expand Up @@ -23,8 +23,6 @@
import org.apache.log4j.spi.LoggingEvent;
import org.apache.samza.diagnostics.DiagnosticsExceptionEvent;
import org.apache.samza.diagnostics.DiagnosticsManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
Expand All @@ -35,7 +33,6 @@
* stream of diagnostics-related events.
*/
public class SimpleDiagnosticsAppender extends AppenderSkeleton {
private static final Logger LOG = LoggerFactory.getLogger(SimpleDiagnosticsAppender.class);

// simple object to synchronize root logger attachment
private static final Object SYNCHRONIZATION_OBJECT = new Object();
Expand All @@ -57,7 +54,7 @@ public SimpleDiagnosticsAppender(DiagnosticsManager diagnosticsManager) {
private void attachAppenderToRootLogger() {
// ensure appender is attached only once per JVM (regardless of #containers)
if (org.apache.log4j.Logger.getRootLogger().getAppender(SimpleDiagnosticsAppender.class.getName()) == null) {
LOG.info("Attaching diagnostics appender to root logger");
System.out.println("Attaching diagnostics appender to root logger");
org.apache.log4j.Logger.getRootLogger().addAppender(this);
}
}
Expand All @@ -73,13 +70,10 @@ protected void append(LoggingEvent loggingEvent) {
loggingEvent.getProperties());

diagnosticsManager.addExceptionEvent(diagnosticsExceptionEvent);
LOG.debug("Received DiagnosticsExceptionEvent " + diagnosticsExceptionEvent);
} else {
LOG.debug("Received non-exception event with message " + loggingEvent.getMessage());
}
} catch (Exception e) {
// blanket catch of all exceptions so as to not impact any job
LOG.error("Exception in logging event parsing", e);
System.err.println("Exception in logging event parsing " + e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
import org.apache.logging.log4j.core.config.LoggerConfig;
import org.apache.samza.diagnostics.DiagnosticsExceptionEvent;
import org.apache.samza.diagnostics.DiagnosticsManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Provides an in-memory appender that parses LogEvents to filter events relevant to diagnostics.
Expand All @@ -39,7 +37,6 @@
* stream of diagnostics-related events.
*/
public class SimpleDiagnosticsAppender extends AbstractAppender {
private static final Logger LOG = LoggerFactory.getLogger(SimpleDiagnosticsAppender.class);

// simple object to synchronize root logger attachment
private static final Object SYNCHRONIZATION_OBJECT = new Object();
Expand All @@ -62,7 +59,7 @@ private void attachAppenderToLoggers(Appender appender) {

// ensure appender is attached only once per JVM (regardless of #containers)
if (config.getRootLogger().getAppenders().get(SimpleDiagnosticsAppender.class.getName()) == null) {
LOG.info("Attaching diagnostics appender to root logger");
System.out.println("Attaching diagnostics appender to root logger");
appender.start();
config.addAppender(appender);
for (final LoggerConfig loggerConfig : config.getLoggers().values()) {
Expand All @@ -81,13 +78,10 @@ public void append(LogEvent logEvent) {
logEvent.getContextData().toMap());

diagnosticsManager.addExceptionEvent(diagnosticsExceptionEvent);
LOG.debug("Received DiagnosticsExceptionEvent " + diagnosticsExceptionEvent);
} else {
LOG.debug("Received non-exception event with message " + logEvent.getMessage());
}
} catch (Exception e) {
// blanket catch of all exceptions so as to not impact any job
LOG.error("Exception in logevent parsing", e);
System.err.println("Exception in logevent parsing " + e);
}
}
}