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

renamed logger #437

Merged
merged 2 commits into from
Mar 17, 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
Expand Up @@ -53,7 +53,7 @@
)
public class ActionMapperRegistryImpl implements RegistryChangedListener, ActionMapperRegistry {

private static final Logger LOG = LoggerFactory.getLogger(ActionMapperRegistryImpl.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ActionMapperRegistryImpl.class);

private static final String BUNDLE_HEADER = "APM-Actions";

Expand Down Expand Up @@ -103,12 +103,12 @@ private static Map<String, MapperDescriptor> createActionMappers(List<Class<?>>
MapperDescriptor mapperDescriptor = mapperDescriptorFactory.create(clazz);
mappers.put(mapperDescriptor.getName(), mapperDescriptor);
} catch (InvalidActionMapperException e) {
LOG.warn("Cannot register ActionMapper of class " + clazz.getName(), e);
LOGGER.warn("Cannot register ActionMapper of class " + clazz.getName(), e);
}
}

if (LOG.isDebugEnabled()) {
LOG.debug("Created {} action mappers from {} classes", mappers.size(), classes.size());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Created {} action mappers from {} classes", mappers.size(), classes.size());
}
return mappers;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*/
public class AnnotatedClassRegistry {

private static final Logger LOG = LoggerFactory.getLogger(AnnotatedClassRegistry.class);
private static final Logger LOGGER = LoggerFactory.getLogger(AnnotatedClassRegistry.class);

private final BundleTracker<?> tracker;

Expand Down Expand Up @@ -106,15 +106,15 @@ private void registerClasses(Bundle bundle) {
classes.put(bundle.getBundleId(), scanned);
notifyChangeListeners();
}
if (LOG.isDebugEnabled()) {
LOG.debug("Adding classes ({}) from bundle: {}", scanned.size(), bundle.getSymbolicName());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Adding classes ({}) from bundle: {}", scanned.size(), bundle.getSymbolicName());
}
}

private void unregisterClasses(Bundle bundle) {
final List<Class<?>> registered = classes.get(bundle.getBundleId());
if (LOG.isDebugEnabled()) {
LOG.debug("Removing classes ({}) from bundle: {}", registered.size(), bundle.getSymbolicName());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Removing classes ({}) from bundle: {}", registered.size(), bundle.getSymbolicName());
}
classes.remove(bundle.getBundleId());
notifyChangeListeners();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public ClassScanner(Bundle bundle, BundleContext context) {
this.context = context;
}

private static final Logger LOG = LoggerFactory.getLogger(ClassScanner.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ClassScanner.class);

public List<Class<?>> findClasses(String packageName) {
@SuppressWarnings("unchecked") final Enumeration<URL> classUrls = bundle
Expand All @@ -61,7 +61,7 @@ public List<Class<?>> findClasses(String packageName) {
final ArrayList<Class<?>> classes = new ArrayList<>();

if (classUrls == null) {
LOG.warn("No classes found in bundle: {}", bundleName);
LOGGER.warn("No classes found in bundle: {}", bundleName);
} else {
while (classUrls.hasMoreElements()) {
final URL url = classUrls.nextElement();
Expand All @@ -70,22 +70,22 @@ public List<Class<?>> findClasses(String packageName) {
try {
if (BundleUtils.isFragment(bundle)) {
if (context == null) {
LOG.warn("Cannot load class from fragment bundle {} if context is unspecified",
LOGGER.warn("Cannot load class from fragment bundle {} if context is unspecified",
bundleName);
}

final Bundle hostBundle = BundleUtils.getHostBundle(context, bundle);

if (hostBundle == null) {
LOG.warn("Cannot find host bundle for {}", bundleName);
LOGGER.warn("Cannot find host bundle for {}", bundleName);
} else {
classes.add(hostBundle.loadClass(className));
}
} else {
classes.add(bundle.loadClass(className));
}
} catch (ClassNotFoundException e) {
LOG.warn("Unable to load class", e);
LOGGER.warn("Unable to load class", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public String getPath() {
}

public static ParsedScript create(Script script) {
Logger LOGGER = LoggerFactory.getLogger(ParsedScript.class);
LOGGER.warn("Script parsing {}", script.getPath());
Logger logger = LoggerFactory.getLogger(ParsedScript.class);
logger.warn("Script parsing {}", script.getPath());
ApmLangParser apmLangParser = ApmLangParserFactory.createParserForScriptContent(script.getData());
return new ParsedScript(script, apmLangParser.apm());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class HistoryImpl implements History {

public static final String HISTORY_FOLDER = "/var/apm/history";

private static final Logger LOG = LoggerFactory.getLogger(HistoryImpl.class);
private static final Logger LOGGER = LoggerFactory.getLogger(HistoryImpl.class);

private static final String APM_HISTORY = "apmHistory";

Expand Down Expand Up @@ -165,7 +165,7 @@ private HistoryEntry createHistoryEntry(ResourceResolver resolver, Script script
resolver.commit();
return resolver.getResource(historyEntryNode.getPath()).adaptTo(HistoryEntryImpl.class);
} catch (IOException | RepositoryException e) {
LOG.error("Issues with saving to repository while logging script execution", e);
LOGGER.error("Issues with saving to repository while logging script execution", e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
)
public class ScriptRunnerJobConsumer {

private static final Logger LOG = LoggerFactory.getLogger(ScriptRunnerJobConsumer.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ScriptRunnerJobConsumer.class);

@Reference
private History history;
Expand All @@ -63,7 +63,7 @@ public class ScriptRunnerJobConsumer {
private ResourceResolverProvider resolverProvider;

public void process(Map<String, Object> properties) {
LOG.info("Script runner properties consumer started");
LOGGER.info("Script runner properties consumer started");
String id = (String) properties.get(AsyncScriptExecutorImpl.ID);
ExecutionMode mode = getMode(properties);
String userId = getUserId(properties);
Expand All @@ -75,7 +75,7 @@ public void process(Map<String, Object> properties) {
String summaryPath = getSummaryPath(resolver, script, mode);
jobResultsCache.put(id, ExecutionSummary.finished(executionResult, summaryPath));
} catch (RepositoryException | PersistenceException e) {
LOG.error("Script manager failed to process script", e);
LOGGER.error("Script manager failed to process script", e);
}
}
});
Expand All @@ -96,7 +96,7 @@ private ExecutionMode getMode(Map<String, Object> properties) {
if (StringUtils.isNotBlank(modeName)) {
result = StringUtils.isEmpty(modeName) ? ExecutionMode.DRY_RUN : ExecutionMode.valueOf(modeName.toUpperCase());
} else {
LOG.error("Mode is null");
LOGGER.error("Mode is null");
}
return result;
}
Expand All @@ -114,12 +114,12 @@ private Script getScript(Map<String, Object> properties, ResourceResolver resolv
if (StringUtils.isNotBlank(scriptSearchPath)) {
Script script = scriptFinder.find(scriptSearchPath, resolver);
if (script == null) {
LOG.error("Script not found: {}", scriptSearchPath);
LOGGER.error("Script not found: {}", scriptSearchPath);
return null;
}
return script;
} else {
LOG.error("Script search path is blank");
LOGGER.error("Script search path is blank");
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
)
public class ScriptManagerImpl implements ScriptManager {

private static final Logger LOG = LoggerFactory.getLogger(ScriptManagerImpl.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ScriptManagerImpl.class);

@Reference
private ActionFactory actionFactory;
Expand Down Expand Up @@ -111,7 +111,7 @@ private Progress execute(Script script, ExecutionMode mode, Map<String, String>

String path = script.getPath();

LOG.info(String.format("Script execution started: %s [%s]", path, mode));
LOGGER.info(String.format("Script execution started: %s [%s]", path, mode));
Progress progress = new ProgressImpl(executor);
ActionExecutor actionExecutor = createExecutor(mode, resolver);
Context context = actionExecutor.getContext();
Expand All @@ -132,7 +132,7 @@ private Progress execute(Script script, ExecutionMode mode, Map<String, String>
}
return result.getStatus();
} catch (RepositoryException | ActionCreationException e) {
LOG.error("Error while processing command: {}", commandName, e);
LOGGER.error("Error while processing command: {}", commandName, e);
progress.addEntry(Status.ERROR, e.getMessage(), commandName);
return Status.ERROR;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
)
public class ScriptStorageImpl implements ScriptStorage {

private static final Logger LOG = LoggerFactory.getLogger(ScriptStorageImpl.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ScriptStorageImpl.class);

private static final Pattern FILE_NAME_PATTERN = Pattern.compile("[0-9a-zA-Z_\\-]+\\.apm");

Expand Down Expand Up @@ -119,7 +119,7 @@ private Script saveScript(FileDescriptor descriptor, LaunchMetadata launchMetada
session.save();
result = scriptFinder.find(fileNode.getPath(), resolver);
} catch (RepositoryException e) {
LOG.error(e.getMessage(), e);
LOGGER.error(e.getMessage(), e);
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public final class ConsoleModel {

public static final String PATH_PARAM = "path";

private static final Logger LOG = LoggerFactory.getLogger(ConsoleModel.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ConsoleModel.class);

private static final String FILE_NAME_DEFAULT = "filename";

Expand Down Expand Up @@ -68,7 +68,7 @@ private String getContentDefault() {
try {
return IOUtils.toString(getClass().getResourceAsStream(CONTENT_FILE), CONTENT_FILE_CHARSET);
} catch (IOException e) {
LOG.warn("Cannot read content of default script template.", e);
LOGGER.warn("Cannot read content of default script template.", e);
return "";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

public final class SlingHelper {

private static final Logger LOG = LoggerFactory.getLogger(SlingHelper.class);
private static final Logger LOGGER = LoggerFactory.getLogger(SlingHelper.class);

private static final String RESOLVE_ERROR_MESSAGE = "Error occurred while resolving data from repository.";

Expand Down Expand Up @@ -55,7 +55,7 @@ public static <T> T resolveDefault(ResourceResolverProvider provider, ResolveCal
try {
return resolve(provider, callback);
} catch (ResolveException e) {
LOG.error(RESOLVE_ERROR_MESSAGE, e);
LOGGER.error(RESOLVE_ERROR_MESSAGE, e);
}
return defaultValue;
}
Expand All @@ -82,7 +82,7 @@ public static void operateTraced(ResourceResolverProvider provider, OperateCallb
try {
operate(provider, callback);
} catch (OperateException e) {
LOG.error(OPERATE_ERROR_MESSAGE, e);
LOGGER.error(OPERATE_ERROR_MESSAGE, e);
}
}

Expand Down
Loading