diff --git a/assemble/conf/log4j2.properties b/assemble/conf/log4j2.properties index 6906e9bb806..9829e61304f 100644 --- a/assemble/conf/log4j2.properties +++ b/assemble/conf/log4j2.properties @@ -33,6 +33,12 @@ appender.console.layout.pattern = %style{%d{ISO8601}}{dim,cyan} %style{[}{red}%s logger.shellaudit.name = org.apache.accumulo.shell.Shell.audit logger.shellaudit.level = warn +logger.core.name = org.apache.accumulo.core +logger.core.level = info + +logger.shell.name = org.apache.accumulo.shell.Shell +logger.shell.level = info + logger.zookeeper.name = org.apache.zookeeper logger.zookeeper.level = error diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java index 8f6b9259ae8..62dd93f2697 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionHelper.java @@ -32,13 +32,10 @@ import org.apache.accumulo.core.client.admin.ActiveCompaction; import org.apache.accumulo.core.client.admin.InstanceOperations; import org.apache.accumulo.core.util.DurationFormat; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.accumulo.shell.Shell; class ActiveCompactionHelper { - private static final Logger log = LoggerFactory.getLogger(ActiveCompactionHelper.class); - private static final Comparator COMPACTION_AGE_DESCENDING = Comparator.comparingLong(ActiveCompaction::getAge).reversed(); @@ -120,7 +117,7 @@ public static Stream activeCompactionsForServer(String tserver, return instanceOps.getActiveCompactions(tserver).stream().sorted(COMPACTION_AGE_DESCENDING) .map(ActiveCompactionHelper::formatActiveCompactionLine); } catch (Exception e) { - log.debug("Failed to list active compactions for server {}", tserver, e); + Shell.log.debug("Failed to list active compactions for server {}", tserver, e); return Stream.of(tserver + " ERROR " + e.getMessage()); } } diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteTableCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteTableCommand.java index 86cd8aa27e9..7d0c90af366 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteTableCommand.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteTableCommand.java @@ -28,11 +28,8 @@ import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class DeleteTableCommand extends TableOperation { - private static final Logger log = LoggerFactory.getLogger(DeleteTableCommand.class); private Option forceOpt; @@ -78,7 +75,7 @@ protected void pruneTables(Set tables) { String table = tableNames.next(); Pair qualifiedName = TableNameUtil.qualify(table); if (Namespace.ACCUMULO.name().equals(qualifiedName.getFirst())) { - log.trace("Removing table from deletion set: {}", table); + Shell.log.trace("Removing table from deletion set: {}", table); tableNames.remove(); } } diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ListTabletsCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ListTabletsCommand.java index 46f3c897cd6..161ba063c39 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/ListTabletsCommand.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ListTabletsCommand.java @@ -42,8 +42,6 @@ import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.google.common.annotations.VisibleForTesting; @@ -53,8 +51,6 @@ */ public class ListTabletsCommand extends Command { - private static final Logger log = LoggerFactory.getLogger(ListTabletsCommand.class); - private Option outputFileOpt; private Option optTablePattern; private Option optHumanReadable; @@ -70,10 +66,9 @@ public class ListTabletsCommand extends Command { public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception { final Set tableInfoSet = populateTables(cl, shellState); if (tableInfoSet.isEmpty()) { - log.warn("No tables found that match your criteria"); + Shell.log.warn("No tables found that match your criteria"); return 0; } - boolean humanReadable = cl.hasOption(optHumanReadable.getOpt()); List lines = new LinkedList<>(); @@ -178,7 +173,7 @@ private Set populateTables(final CommandLine cl, final Shell shellSta TableId id = TableId.of(tableIdString); tableSet.add(new TableInfo(name, id)); } else { - log.warn("Table not found: {}", name); + Shell.log.warn("Table not found: {}", name); } }); return tableSet; @@ -191,7 +186,7 @@ private Set populateTables(final CommandLine cl, final Shell shellSta TableId id = TableId.of(idString); tableSet.add(new TableInfo(table, id)); } else { - log.warn("Table not found: {}", table); + Shell.log.warn("Table not found: {}", table); } return tableSet; } diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/MaxRowCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/MaxRowCommand.java index 044957d02d5..cd967f445dc 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/MaxRowCommand.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/MaxRowCommand.java @@ -23,13 +23,9 @@ import org.apache.accumulo.shell.Shell; import org.apache.commons.cli.CommandLine; import org.apache.hadoop.io.Text; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class MaxRowCommand extends ScanCommand { - private static final Logger log = LoggerFactory.getLogger(MaxRowCommand.class); - @Override public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { @@ -47,7 +43,7 @@ public int execute(final String fullCommand, final CommandLine cl, final Shell s shellState.getWriter().println(max); } } catch (Exception e) { - log.debug("Could not get shell state.", e); + Shell.log.debug("Could not get shell state.", e); } return 0; diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ShellPluginConfigurationCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ShellPluginConfigurationCommand.java index 3614c621db6..06e3dcd19b2 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/ShellPluginConfigurationCommand.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ShellPluginConfigurationCommand.java @@ -34,7 +34,6 @@ import org.apache.commons.cli.OptionGroup; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; -import org.slf4j.LoggerFactory; public abstract class ShellPluginConfigurationCommand extends Command { private Option removePluginOption, pluginClassOption, listPluginOption; @@ -115,20 +114,16 @@ public static Class getPluginClass(final String tableName, pluginClazz = shellState.getClassLoader(cl, shellState).loadClass(ent.getValue()).asSubclass(clazz); } catch (ClassNotFoundException e) { - LoggerFactory.getLogger(ShellPluginConfigurationCommand.class).error("Class not found {}", - e.getMessage()); + Shell.log.error("Class not found {}", e.getMessage()); return null; } catch (ParseException e) { - LoggerFactory.getLogger(ShellPluginConfigurationCommand.class) - .error("Error parsing table: {} {}", Arrays.toString(args), e.getMessage()); + Shell.log.error("Error parsing table: {} {}", Arrays.toString(args), e.getMessage()); return null; } catch (TableNotFoundException e) { - LoggerFactory.getLogger(ShellPluginConfigurationCommand.class) - .error("Table not found: {} {}", tableName, e.getMessage()); + Shell.log.error("Table not found: {} {}", tableName, e.getMessage()); return null; } catch (Exception e) { - LoggerFactory.getLogger(ShellPluginConfigurationCommand.class).error("Error: {}", - e.getMessage()); + Shell.log.error("Error: {}", e.getMessage()); return null; }