PL-10096 Replace Log4JStopWatch with Slf4JStopWatch

This commit is contained in:
Yuriy Artamonov 2017-11-30 16:36:49 +04:00
parent 972787f685
commit 1fa505a42d
25 changed files with 105 additions and 110 deletions

View File

@ -25,12 +25,12 @@ import com.haulmont.cuba.core.global.UserSessionSource;
import com.haulmont.cuba.core.sys.AbstractMessages;
import com.haulmont.cuba.core.sys.AppContext;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.perf4j.StopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.springframework.stereotype.Component;
import javax.inject.Inject;
import java.net.SocketException;
import java.util.List;
@ -74,7 +74,7 @@ public class MessagesClientImpl extends AbstractMessages {
if (log.isTraceEnabled())
log.trace("searchRemotely: " + pack + "/" + locale + "/" + key);
StopWatch stopWatch = new Log4JStopWatch("Messages.searchRemotely");
StopWatch stopWatch = new Slf4JStopWatch("Messages.searchRemotely");
try {
String message = localizedMessageService.getMessage(pack, key, locale);
if (key.equals(message))

View File

@ -28,7 +28,7 @@ import org.jgroups.*;
import org.jgroups.conf.XmlConfigurator;
import org.jgroups.jmx.JmxConfigurator;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.Ordered;
@ -122,7 +122,7 @@ public class ClusterManager implements ClusterManagerAPI, AppContext.Listener, O
}
protected void internalSend(Serializable message, boolean sync) {
StopWatch sw = new Log4JStopWatch(String.format("sendClusterMessage(%s)", message.getClass().getSimpleName()));
StopWatch sw = new Slf4JStopWatch(String.format("sendClusterMessage(%s)", message.getClass().getSimpleName()));
try {
byte[] bytes = SerializationSupport.serialize(message);
log.debug("Sending message: {}: {} ({} bytes)", message.getClass(), message, bytes.length);
@ -395,7 +395,7 @@ public class ClusterManager implements ClusterManagerAPI, AppContext.Listener, O
log.debug("Null buffer received");
return;
}
StopWatch sw = new Log4JStopWatch();
StopWatch sw = new Slf4JStopWatch();
String simpleClassName = null;
try {
Serializable data = (Serializable) SerializationSupport.deserialize(bytes);
@ -428,7 +428,7 @@ public class ClusterManager implements ClusterManagerAPI, AppContext.Listener, O
Map<String, byte[]> state = new HashMap<>();
for (Map.Entry<String, ClusterListener> entry : listeners.entrySet()) {
byte[] data;
StopWatch sw = new Log4JStopWatch(String.format("getClusterState(%s)", entry.getKey()));
StopWatch sw = new Slf4JStopWatch(String.format("getClusterState(%s)", entry.getKey()));
try {
data = entry.getValue().getState();
} finally {
@ -476,7 +476,7 @@ public class ClusterManager implements ClusterManagerAPI, AppContext.Listener, O
for (int i = 0; i < count; i++) {
String name = in.readUTF();
int len = in.readInt();
StopWatch sw = new Log4JStopWatch(String.format("setClusterState(%s)", name));
StopWatch sw = new Slf4JStopWatch(String.format("setClusterState(%s)", name));
try {
log.debug("Receiving state: {} ({} bytes)", name, len);
byte[] data = new byte[len];

View File

@ -27,14 +27,14 @@ import org.apache.commons.codec.EncoderException;
import org.apache.commons.codec.net.QCodec;
import org.apache.commons.lang.StringUtils;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.mail.Message;
@ -63,11 +63,11 @@ public class EmailSender implements EmailSenderAPI {
public void sendEmail(SendingMessage sendingMessage) throws MessagingException {
MimeMessage msg = createMimeMessage(sendingMessage);
StopWatch sw = new Log4JStopWatch("EmailSender.send");
StopWatch sw = new Slf4JStopWatch("EmailSender.send");
mailSender.send(msg);
sw.stop();
log.info("Email '" + msg.getSubject() + "' to '" + sendingMessage.getAddress() + "' has been sent successfully");
log.info("Email '{}' to '{}' has been sent successfully", msg.getSubject(), sendingMessage.getAddress());
}
protected MimeMessage createMimeMessage(SendingMessage sendingMessage) throws MessagingException {
@ -154,7 +154,7 @@ public class EmailSender implements EmailSenderAPI {
if (emailHeader != null) {
message.addHeader(emailHeader.getName(), emailHeader.getValue());
} else {
log.warn("Can't parse email header: '" + header + "'");
log.warn("Can't parse email header: '{}'", header);
}
}
}

View File

@ -42,7 +42,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@ -86,7 +86,7 @@ public class FoldersServiceBean implements FoldersService {
public List<AppFolder> loadAppFolders() {
log.debug("Loading AppFolders");
StopWatch stopWatch = new Log4JStopWatch("AppFolders");
StopWatch stopWatch = new Slf4JStopWatch("AppFolders");
stopWatch.start();
List<AppFolder> resultList;
@ -157,7 +157,7 @@ public class FoldersServiceBean implements FoldersService {
public List<AppFolder> reloadAppFolders(List<AppFolder> folders) {
log.debug("Reloading AppFolders {}", folders);
StopWatch stopWatch = new Log4JStopWatch("AppFolders");
StopWatch stopWatch = new Slf4JStopWatch("AppFolders");
stopWatch.start();
try {
@ -210,7 +210,7 @@ public class FoldersServiceBean implements FoldersService {
public List<SearchFolder> loadSearchFolders() {
log.debug("Loading SearchFolders");
StopWatch stopWatch = new Log4JStopWatch("SearchFolders");
StopWatch stopWatch = new Slf4JStopWatch("SearchFolders");
stopWatch.start();
Transaction tx = persistence.createTransaction();

View File

@ -34,7 +34,7 @@ import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.support.CronSequenceGenerator;
@ -109,7 +109,7 @@ public class Scheduling implements SchedulingAPI {
authentication.begin();
try {
StopWatch sw = new Log4JStopWatch("Scheduling.processTasks");
StopWatch sw = new Slf4JStopWatch("Scheduling.processTasks");
Coordinator.Context context = coordinator.begin();
try {
for (ScheduledTask task : context.getTasks()) {
@ -291,7 +291,7 @@ public class Scheduling implements SchedulingAPI {
}
protected long calculateNextCronDate(ScheduledTask task, long date, long currentDate, long frame) {
StopWatch sw = new Log4JStopWatch("Cron next date calculations");
StopWatch sw = new Slf4JStopWatch("Cron next date calculations");
CronSequenceGenerator cronSequenceGenerator = new CronSequenceGenerator(task.getCron(), getCurrentTimeZone());
//if last start = 0 (task never has run) or to far in the past, we use (NOW - FRAME) timestamp for pivot time
//this approach should work fine cause cron works with absolute time

View File

@ -18,12 +18,12 @@ package com.haulmont.cuba.core.sys;
import org.aspectj.lang.ProceedingJoinPoint;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
public class PerformanceLogInterceptor {
@SuppressWarnings("UnusedDeclaration")
@SuppressWarnings({"UnusedDeclaration", "UnnecessaryLocalVariable"})
private Object aroundInvoke(ProceedingJoinPoint ctx) throws Throwable {
StopWatch stopWatch = new Log4JStopWatch(ctx.getSignature().toShortString());
StopWatch stopWatch = new Slf4JStopWatch(ctx.getSignature().toShortString());
try {
stopWatch.start();
Object res = ctx.proceed();

View File

@ -59,7 +59,7 @@ import org.jdesktop.swingx.table.ColumnControlButton;
import org.jdesktop.swingx.table.TableColumnExt;
import org.jdesktop.swingx.table.TableColumnModelExt;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import javax.annotation.Nullable;
import javax.swing.AbstractAction;
@ -2141,7 +2141,7 @@ public abstract class DesktopAbstractTable<C extends JXTable, E extends Entity>
int preferredRowHeight = -1;
boolean equalsRowHeight = true;
StopWatch sw = new Log4JStopWatch("DAT packRows " + id);
StopWatch sw = new Slf4JStopWatch("DAT packRows " + id);
for (int r = 0; r < impl.getRowCount(); r++) {
int h = getPreferredRowHeight(r);

View File

@ -20,11 +20,11 @@ package com.haulmont.cuba.desktop.gui.components;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.desktop.sys.vcl.DatePicker.DatePicker;
import com.haulmont.cuba.desktop.sys.vcl.Flushable;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.components.Label;
import com.haulmont.cuba.gui.components.Table;
import org.jdesktop.swingx.JXHyperlink;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import javax.swing.*;
import javax.swing.border.Border;
@ -32,7 +32,6 @@ import javax.swing.border.EmptyBorder;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
import java.awt.Component;
import java.util.*;
import static com.haulmont.cuba.gui.components.Component.BelongToFrame;
@ -125,7 +124,7 @@ public class DesktopTableCellEditor extends AbstractCellEditor implements TableC
protected Component getCellComponent(int row) {
Entity item = desktopAbstractTable.getTableModel().getItem(row);
StopWatch sw = new Log4JStopWatch("TableColumnGenerator." + desktopAbstractTable.getId());
StopWatch sw = new Slf4JStopWatch("TableColumnGenerator." + desktopAbstractTable.getId());
@SuppressWarnings("unchecked")
com.haulmont.cuba.gui.components.Component component = columnGenerator.generateCell(item);
sw.stop();

View File

@ -28,7 +28,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.text.StrBuilder;
import org.apache.commons.lang.text.StrTokenizer;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -401,7 +401,7 @@ public abstract class AbstractMessages implements Messages {
}
protected String searchFiles(String pack, String key, Locale locale, Locale truncatedLocale, Set<String> passedPacks) {
StopWatch stopWatch = new Log4JStopWatch("Messages.searchFiles");
StopWatch stopWatch = new Slf4JStopWatch("Messages.searchFiles");
try {
String cacheKey = makeCacheKey(pack, key, locale, truncatedLocale);
@ -433,7 +433,7 @@ public abstract class AbstractMessages implements Messages {
}
protected String searchClasspath(String pack, String key, Locale locale, Locale truncatedLocale, Set<String> passedPacks) {
StopWatch stopWatch = new Log4JStopWatch("Messages.searchClasspath");
StopWatch stopWatch = new Slf4JStopWatch("Messages.searchClasspath");
try {
String cacheKey = makeCacheKey(pack, key, locale, truncatedLocale);

View File

@ -33,7 +33,7 @@ import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -89,7 +89,7 @@ public class AbstractViewRepository implements ViewRepository {
}
protected void init() {
StopWatch initTiming = new Log4JStopWatch("ViewRepository.init." + getClass().getSimpleName());
StopWatch initTiming = new Slf4JStopWatch("ViewRepository.init." + getClass().getSimpleName());
storage.clear();
readFileNames.clear();
@ -471,7 +471,7 @@ public class AbstractViewRepository implements ViewRepository {
}
protected void replaceOverridden(View replacementView) {
Log4JStopWatch replaceTiming = new Log4JStopWatch("ViewRepository.replaceOverridden");
StopWatch replaceTiming = new Slf4JStopWatch("ViewRepository.replaceOverridden");
HashSet<View> checked = new HashSet<>();

View File

@ -45,7 +45,7 @@ import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
@ -263,7 +263,7 @@ public class MetadataLoader {
}
protected void replaceExtendedMetaClasses() {
StopWatch sw = new Log4JStopWatch("Metadata.replaceExtendedMetaClasses");
StopWatch sw = new Slf4JStopWatch("Metadata.replaceExtendedMetaClasses");
for (MetaModel model : session.getModels()) {
MetaModelImpl modelImpl = (MetaModelImpl) model;

View File

@ -24,7 +24,8 @@ import com.haulmont.cuba.core.global.TimeSource;
import com.haulmont.cuba.core.sys.SpringBeanLoader;
import com.haulmont.cuba.core.sys.javacl.compiler.CharSequenceCompiler;
import org.apache.commons.lang.StringUtils;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.StopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@ -101,7 +102,7 @@ public class JavaClassLoader extends URLClassLoader {
public Class loadClass(final String fullClassName, boolean resolve) throws ClassNotFoundException {
String containerClassName = StringUtils.substringBefore(fullClassName, "$");
Log4JStopWatch loadingWatch = new Log4JStopWatch("LoadClass");
StopWatch loadingWatch = new Slf4JStopWatch("LoadClass");
try {
lock(containerClassName);
Class clazz;

View File

@ -44,10 +44,9 @@ import com.haulmont.cuba.gui.xml.layout.loaders.ComponentLoaderContext;
import com.haulmont.cuba.security.entity.PermissionType;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.dom4j.Element;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
@ -545,9 +544,9 @@ public abstract class WindowManager {
checkPermission(windowInfo);
}
StopWatch loadDescriptorWatch = new Log4JStopWatch(windowInfo.getId() + "#" +
StopWatch loadDescriptorWatch = new Slf4JStopWatch(windowInfo.getId() + "#" +
LifeCycle.LOAD,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
Element element = screenXmlLoader.load(windowInfo.getTemplate(), windowInfo.getId(), params);
@ -588,9 +587,9 @@ public abstract class WindowManager {
initDebugIds(clientSpecificWindow);
}
StopWatch uiPermissionsWatch = new Log4JStopWatch(windowInfo.getId() + "#" +
StopWatch uiPermissionsWatch = new Slf4JStopWatch(windowInfo.getId() + "#" +
LifeCycle.UI_PERMISSIONS,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
// apply ui permissions
WindowCreationHelper.applyUiPermissions(clientSpecificWindow);
@ -682,9 +681,9 @@ public abstract class WindowManager {
init(window, params);
StopWatch uiPermissionsWatch = new Log4JStopWatch(windowInfo.getId() + "#" +
StopWatch uiPermissionsWatch = new Slf4JStopWatch(windowInfo.getId() + "#" +
LifeCycle.UI_PERMISSIONS,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
// apply ui permissions
WindowCreationHelper.applyUiPermissions(window);
@ -882,9 +881,9 @@ public abstract class WindowManager {
}
((Window.Editor) window).setParentDs(parentDs);
StopWatch setItemWatch = new Log4JStopWatch(windowInfo.getId() + "#" +
StopWatch setItemWatch = new Slf4JStopWatch(windowInfo.getId() + "#" +
LifeCycle.SET_ITEM,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
((Window.Editor) window).setItem(item);
@ -980,9 +979,9 @@ public abstract class WindowManager {
loader.setLocale(getLocale());
loader.setMessagesPack(parentFrame.getMessagesPack());
StopWatch loadDescriptorWatch = new Log4JStopWatch(windowInfo.getId() + "#" +
StopWatch loadDescriptorWatch = new Slf4JStopWatch(windowInfo.getId() + "#" +
LifeCycle.LOAD,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
Frame component;
String frameId = id != null ? id : windowInfo.getId();
@ -1168,9 +1167,9 @@ public abstract class WindowManager {
attributeAccessSupport.applyAttributeAccess(abstractWindow, false);
}
StopWatch readyStopWatch = new Log4JStopWatch(window.getId() + "#" +
StopWatch readyStopWatch = new Slf4JStopWatch(window.getId() + "#" +
LifeCycle.READY,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
abstractWindow.ready();
@ -1206,9 +1205,9 @@ public abstract class WindowManager {
if (wrappingWindow instanceof AbstractWindow) {
Element companionsElem = element.element("companions");
if (companionsElem != null) {
StopWatch companionStopWatch = new Log4JStopWatch(wrappingWindow.getId() + "#" +
StopWatch companionStopWatch = new Slf4JStopWatch(wrappingWindow.getId() + "#" +
LifeCycle.COMPANION,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
initCompanion(companionsElem, (AbstractWindow) wrappingWindow);
@ -1216,9 +1215,9 @@ public abstract class WindowManager {
}
}
StopWatch injectStopWatch = new Log4JStopWatch(wrappingWindow.getId() + "#" +
StopWatch injectStopWatch = new Slf4JStopWatch(wrappingWindow.getId() + "#" +
LifeCycle.INJECTION,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
ControllerDependencyInjector dependencyInjector =
AppBeans.getPrototype(ControllerDependencyInjector.NAME, wrappingWindow, params);
@ -1236,9 +1235,9 @@ public abstract class WindowManager {
protected void init(Window window, Map<String, Object> params) {
if (window instanceof AbstractWindow) {
StopWatch initStopWatch = new Log4JStopWatch(window.getId() +
StopWatch initStopWatch = new Slf4JStopWatch(window.getId() +
"#" + LifeCycle.INIT,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
((AbstractWindow) window).init(params);

View File

@ -32,7 +32,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.reflect.MethodUtils;
import org.dom4j.Element;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -71,7 +71,7 @@ public class MenuCommand {
}
public void execute() {
StopWatch sw = new Log4JStopWatch("MenuItem." + item.getId());
StopWatch sw = new Slf4JStopWatch("MenuItem." + item.getId());
command.run();

View File

@ -23,9 +23,9 @@ import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.gui.data.HierarchicalDatasource;
import com.haulmont.cuba.gui.logging.UIPerformanceLogger;
import org.apache.commons.lang.ObjectUtils;
import org.apache.log4j.Logger;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.LoggerFactory;
import java.util.*;
@ -43,7 +43,7 @@ public abstract class AbstractTreeDatasource<T extends Entity<K>, K>
@Override
protected void loadData(Map<String, Object> params) {
String tag = getLoggingTag("TDS");
StopWatch sw = new Log4JStopWatch(tag, Logger.getLogger(UIPerformanceLogger.class));
StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
clear();

View File

@ -31,9 +31,9 @@ import com.haulmont.cuba.gui.data.CollectionDatasource;
import com.haulmont.cuba.gui.logging.UIPerformanceLogger;
import com.haulmont.cuba.security.entity.EntityOp;
import org.apache.commons.collections4.map.LinkedMap;
import org.apache.log4j.Logger;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.LoggerFactory;
import java.util.*;
@ -602,7 +602,7 @@ public class CollectionDatasourceImpl<T extends Entity<K>, K>
}
String tag = getLoggingTag("CDS");
StopWatch sw = new Log4JStopWatch(tag, Logger.getLogger(UIPerformanceLogger.class));
StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
if (needLoading()) {
LoadContext context = beforeLoadData(params);

View File

@ -26,9 +26,9 @@ import com.haulmont.cuba.gui.data.CollectionDatasource;
import com.haulmont.cuba.gui.data.DataSupplier;
import com.haulmont.cuba.gui.data.DsContext;
import com.haulmont.cuba.gui.logging.UIPerformanceLogger;
import org.apache.log4j.Logger;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.Map;
@ -78,7 +78,7 @@ public class ValueCollectionDatasourceImpl
@Override
protected void loadData(Map<String, Object> params) {
String tag = getLoggingTag("VDS");
StopWatch sw = new Log4JStopWatch(tag, Logger.getLogger(UIPerformanceLogger.class));
StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
delegate.loadData(params);

View File

@ -26,9 +26,9 @@ import com.haulmont.cuba.gui.data.DataSupplier;
import com.haulmont.cuba.gui.data.DsContext;
import com.haulmont.cuba.gui.data.GroupDatasource;
import com.haulmont.cuba.gui.logging.UIPerformanceLogger;
import org.apache.log4j.Logger;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.Map;
@ -78,7 +78,7 @@ public class ValueGroupDatasourceImpl
@Override
protected void loadData(Map<String, Object> params) {
String tag = getLoggingTag("VGDS");
StopWatch sw = new Log4JStopWatch(tag, Logger.getLogger(UIPerformanceLogger.class));
StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
delegate.loadData(params);

View File

@ -26,9 +26,9 @@ import com.haulmont.cuba.gui.data.DataSupplier;
import com.haulmont.cuba.gui.data.DsContext;
import com.haulmont.cuba.gui.data.HierarchicalDatasource;
import com.haulmont.cuba.gui.logging.UIPerformanceLogger;
import org.apache.log4j.Logger;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.Map;
@ -87,7 +87,7 @@ public class ValueHierarchicalDatasourceImpl
@Override
protected void loadData(Map<String, Object> params) {
String tag = getLoggingTag("VHDS");
StopWatch sw = new Log4JStopWatch(tag, Logger.getLogger(UIPerformanceLogger.class));
StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
delegate.loadData(params);

View File

@ -21,11 +21,11 @@ import com.haulmont.cuba.core.global.Resources;
import com.haulmont.cuba.gui.logging.UIPerformanceLogger;
import com.haulmont.cuba.gui.xml.XmlInheritanceProcessor;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
import org.dom4j.Document;
import org.dom4j.Element;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.inject.Inject;
@ -59,9 +59,9 @@ public class ScreenXmlLoader {
* @return root XML element
*/
public Element load(String resourcePath, String id, Map<String, Object> params) {
StopWatch xmlLoadWatch = new Log4JStopWatch(id + "#" +
StopWatch xmlLoadWatch = new Slf4JStopWatch(id + "#" +
UIPerformanceLogger.LifeCycle.XML,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
String template = loadTemplate(resourcePath);
Document document = getDocument(template, params);

View File

@ -27,14 +27,11 @@ import com.haulmont.cuba.gui.logging.UIPerformanceLogger;
import com.haulmont.cuba.gui.xml.layout.ComponentLoader;
import com.haulmont.cuba.gui.xml.layout.LayoutLoader;
import com.haulmont.cuba.gui.xml.layout.LayoutLoaderConfig;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.dom4j.Element;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import java.io.InputStream;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.LoggerFactory;
public class FrameComponentLoader extends ContainerLoader<Frame> {
@ -114,9 +111,9 @@ public class FrameComponentLoader extends ContainerLoader<Frame> {
}
}
StopWatch loadDescriptorWatch = new Log4JStopWatch(screenPath + "#" +
StopWatch loadDescriptorWatch = new Slf4JStopWatch(screenPath + "#" +
UIPerformanceLogger.LifeCycle.LOAD,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
loadDescriptorWatch.start();
String currentFrameId = context.getCurrentFrameId();

View File

@ -29,10 +29,9 @@ import com.haulmont.cuba.gui.data.impl.DatasourceImplementation;
import com.haulmont.cuba.gui.logging.UIPerformanceLogger;
import com.haulmont.cuba.gui.xml.data.DsContextLoader;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.dom4j.Element;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.LoggerFactory;
import java.util.Map;
@ -221,9 +220,9 @@ public class FrameLoader<T extends Frame> extends ContainerLoader<T> {
if (wrappingFrame instanceof AbstractFrame) {
Element companionsElem = element.element("companions");
if (companionsElem != null) {
StopWatch companionStopWatch = new Log4JStopWatch(loggingId + "#" +
StopWatch companionStopWatch = new Slf4JStopWatch(loggingId + "#" +
UIPerformanceLogger.LifeCycle.COMPANION,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
initCompanion(companionsElem, (AbstractFrame) wrappingFrame);
@ -231,9 +230,9 @@ public class FrameLoader<T extends Frame> extends ContainerLoader<T> {
}
}
StopWatch injectStopWatch = new Log4JStopWatch(loggingId + "#" +
StopWatch injectStopWatch = new Slf4JStopWatch(loggingId + "#" +
UIPerformanceLogger.LifeCycle.INJECTION,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
ControllerDependencyInjector dependencyInjector =
AppBeans.getPrototype(ControllerDependencyInjector.NAME, wrappingFrame, params);
@ -263,9 +262,9 @@ public class FrameLoader<T extends Frame> extends ContainerLoader<T> {
String loggingId = ComponentsHelper.getFullFrameId(this.frame);
if (this.frame instanceof AbstractFrame) {
StopWatch initStopWatch = new Log4JStopWatch(loggingId + "#" +
StopWatch initStopWatch = new Slf4JStopWatch(loggingId + "#" +
UIPerformanceLogger.LifeCycle.INIT,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
((AbstractFrame) this.frame).init(params);
@ -291,9 +290,9 @@ public class FrameLoader<T extends Frame> extends ContainerLoader<T> {
if (wrapped) {
String loggingId = ComponentsHelper.getFullFrameId(this.frame);
StopWatch uiPermissionsWatch = new Log4JStopWatch(loggingId + "#" +
StopWatch uiPermissionsWatch = new Slf4JStopWatch(loggingId + "#" +
UIPerformanceLogger.LifeCycle.UI_PERMISSIONS,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
// apply ui permissions
WindowCreationHelper.applyUiPermissions(window);

View File

@ -26,10 +26,10 @@ import com.haulmont.cuba.gui.xml.layout.ComponentLoader;
import com.haulmont.cuba.gui.xml.layout.LayoutLoader;
import com.haulmont.cuba.gui.xml.layout.LayoutLoaderConfig;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.dom4j.Element;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.LoggerFactory;
public class RuntimePropertiesFrameLoader extends ContainerLoader<Frame> {
@ -119,9 +119,9 @@ public class RuntimePropertiesFrameLoader extends ContainerLoader<Frame> {
}
}
StopWatch loadDescriptorWatch = new Log4JStopWatch(screenPath + "#" +
StopWatch loadDescriptorWatch = new Slf4JStopWatch(screenPath + "#" +
UIPerformanceLogger.LifeCycle.LOAD,
Logger.getLogger(UIPerformanceLogger.class));
LoggerFactory.getLogger(UIPerformanceLogger.class));
loadDescriptorWatch.start();
String currentFrameId = context.getCurrentFrameId();

View File

@ -22,9 +22,9 @@ import com.haulmont.cuba.core.global.AppBeans;
import com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl;
import com.haulmont.cuba.gui.logging.UIPerformanceLogger;
import com.haulmont.cuba.web.jmx.JmxControlAPI;
import org.apache.log4j.Logger;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.UUID;
@ -36,7 +36,7 @@ public class JmxInstancesDatasource extends CollectionDatasourceImpl<JmxInstance
@Override
protected void loadData(Map<String, Object> params) {
String tag = getLoggingTag("CDS");
StopWatch sw = new Log4JStopWatch(tag, Logger.getLogger(UIPerformanceLogger.class));
StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
detachListener(data.values());
data.clear();

View File

@ -23,12 +23,12 @@ import com.haulmont.cuba.core.entity.JmxInstance;
import com.haulmont.cuba.core.global.AppBeans;
import com.haulmont.cuba.gui.data.impl.AbstractTreeDatasource;
import com.haulmont.cuba.gui.logging.UIPerformanceLogger;
import com.haulmont.cuba.web.jmx.JmxControlAPI;
import com.haulmont.cuba.web.jmx.entity.ManagedBeanDomain;
import com.haulmont.cuba.web.jmx.entity.ManagedBeanInfo;
import com.haulmont.cuba.web.jmx.JmxControlAPI;
import org.apache.log4j.Logger;
import org.perf4j.StopWatch;
import org.perf4j.log4j.Log4JStopWatch;
import org.perf4j.slf4j.Slf4JStopWatch;
import org.slf4j.LoggerFactory;
import java.util.*;
@ -41,7 +41,7 @@ public class ManagedBeanInfoDatasource extends AbstractTreeDatasource<ManagedBea
@Override
protected Tree<ManagedBeanInfo> loadTree(Map<String, Object> params) {
String tag = getLoggingTag("TDS");
StopWatch sw = new Log4JStopWatch(tag, Logger.getLogger(UIPerformanceLogger.class));
StopWatch sw = new Slf4JStopWatch(tag, LoggerFactory.getLogger(UIPerformanceLogger.class));
List<Node<ManagedBeanInfo>> nodes = new ArrayList<>();
if (jmxInstance != null) {
@ -50,7 +50,7 @@ public class ManagedBeanInfoDatasource extends AbstractTreeDatasource<ManagedBea
Map<String, Node<ManagedBeanInfo>> domainMap = new HashMap<>();
for (ManagedBeanDomain mbd : domains) {
ManagedBeanInfo dummy = new ManagedBeanInfo();
ManagedBeanInfo dummy = metadata.create(ManagedBeanInfo.class);
dummy.setDomain(mbd.getName());
Node<ManagedBeanInfo> node = new Node<>(dummy);