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

Get rid of log4j #127

Closed
wants to merge 2 commits into from
Closed
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
19 changes: 9 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jna.version>5.6.0</jna.version>
<mockito.version>3.3.3</mockito.version>
<log4j.version>2.16.0</log4j.version>
<slf4j.version>1.7.32</slf4j.version>
<logback.version>1.2.9</logback.version>
</properties>

<dependencies>
Expand All @@ -60,17 +61,16 @@
<version>${jna.version}</version>
</dependency>

<!-- log4j -->

<!-- slf4j -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>

<!-- Mockito -->
Expand Down Expand Up @@ -283,4 +283,3 @@
</plugins>
</reporting>
</project>

Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import mmarquee.automation.pattern.*;
import mmarquee.uiautomation.OrientationType;
import mmarquee.uiautomation.TreeScope;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
Expand All @@ -47,7 +47,7 @@ public abstract class AutomationBase
* The logger.
*/
private final Logger logger =
LogManager.getLogger(AutomationBase.class.getName());
LoggerFactory.getLogger(AutomationBase.class.getName());

/**
* Gets the logger.
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/mmarquee/automation/pattern/BasePattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import mmarquee.uiautomation.IUIAutomationElementArray;
import mmarquee.uiautomation.IUIAutomationElementArrayConverter;
import mmarquee.uiautomation.IUIAutomationElementConverter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

import java.util.function.Function;

Expand All @@ -42,7 +42,7 @@ public abstract class BasePattern
/**
* The logger.
*/
final Logger logger = LogManager.getLogger(BasePattern.class.getName());
final Logger logger = LoggerFactory.getLogger(BasePattern.class.getName());

/**
* The guid of the pattern.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/mmarquee/demo/DemoGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void run() {
}

// Check that the attached issue is fixed.
logger.info(application.getIsAttached());
logger.info("{}", application.getIsAttached());

// Wait for the process to start
// This doesn't seem to wait for WPF examples
Expand Down Expand Up @@ -77,7 +77,7 @@ public void run() {
try {
boolean val = applicationWindow.isModal();

logger.info(val);
logger.info("{}", val);
} catch (Exception ex) {
logger.info("Ouch");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mmarquee/demo/DemoPointOver.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public final void run() {
logger.info("From focus = " + elementFocus.getName());

} catch (Exception ex) {
logger.info(ex.getStackTrace());
logger.info(ex.getMessage(), ex);
}
} while (true);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/mmarquee/demo/TestBase.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package mmarquee.demo;

import mmarquee.automation.controls.AutomationBase;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

/**
* @author Mark Humphreys
Expand All @@ -11,7 +11,7 @@
public class TestBase {

protected Logger logger =
LogManager.getLogger(AutomationBase.class.getName());
LoggerFactory.getLogger(AutomationBase.class.getName());

protected void rest() {
try {
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/mmarquee/demo/TestMainExcel.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public final void run() {

List<TabItem> items = tab.getTabItems();

logger.info(items.size());
logger.info("{}", items.size());

for(TabItem item : items) {
logger.info(item.getName());
Expand All @@ -86,24 +86,24 @@ public final void run() {
Search.getBuilder(0,0).build());
logger.info(cell.getName());
logger.info(cell.getValue());
logger.info(cell.getColumn());
logger.info(cell.getRow());
logger.info("{}", cell.getColumn());
logger.info("{}", cell.getRow());

DataGridCell cell1 =
grid.getItem(
Search.getBuilder(1,1).build());
logger.info(cell1.getName());
logger.info(cell1.getValue());
logger.info(cell1.getColumn());
logger.info(cell1.getRow());
logger.info("{}", cell1.getColumn());
logger.info("{}", cell1.getRow());

DataGridCell cell2 =
grid.getItem(
Search.getBuilder(2,2).build());
logger.info(cell2.getName());
logger.info(cell2.getValue());
logger.info(cell2.getColumn());
logger.info(cell2.getRow());
logger.info("{}", cell2.getColumn());
logger.info("{}", cell2.getRow());

// 3.5 Set some data
cell2.setValue("XYZ");
Expand All @@ -123,13 +123,13 @@ public final void run() {

// something
List<Element> items0 = grid.getSelection();
logger.info(items0.size());
logger.info("{}", items0.size());

cell2.removeFromSelection();

// something again - should be different
List<Element> items1 = grid.getSelection();
logger.info(items1.size());
logger.info("{}", items1.size());
} else {
logger.info("Multiple selection not allowed");
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/mmarquee/demo/TestMainWPF.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public final void run() {
try {
boolean val = applicationWindow.isModal();

logger.info(val);
logger.info("{}", val);
} catch (Exception ex) {
logger.info("Ouch");
}
Expand Down Expand Up @@ -624,8 +624,8 @@ public final void run() {

WinDef.POINT clickPoint = rightClickBtn.getClickablePoint();

logger.info(clickPoint.x);
logger.info(clickPoint.y);
logger.info("{}", clickPoint.x);
logger.info("{}", clickPoint.y);

WinDef.RECT rect0 = rightClickBtn.getBoundingRectangle();

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mmarquee/demo/TestMainWPFAutomationId.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public final void run() {
try {
boolean val = applicationWindow.isModal();

logger.info(val);
logger.info("{}", val);
} catch (Exception ex) {
logger.info("Ouch");
}
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/mmarquee/demo/TestNotepad.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
import mmarquee.automation.controls.*;
import mmarquee.automation.controls.MainMenu;
import mmarquee.automation.controls.MenuItem;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.regex.Pattern;


/**
* Test the automation wrapper on a Delphi VCL application.
*
Expand All @@ -41,7 +42,7 @@ public final void run() {
UIAutomation automation = UIAutomation.getInstance();

Logger logger =
LogManager.getLogger(AutomationBase.class.getName());
LoggerFactory.getLogger(AutomationBase.class.getName());

Application application =
new Application(
Expand Down
9 changes: 0 additions & 9 deletions src/main/resources/log4j.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import java.util.List;

import mmarquee.automation.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -68,7 +68,7 @@
*/
public class AutomationBaseTest {
protected Logger logger =
LogManager.getLogger(AutomationBaseTest.class.getName());
LoggerFactory.getLogger(AutomationBaseTest.class.getName());

@BeforeClass
public static void checkOs() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import static org.mockito.Mockito.when;

import mmarquee.uiautomation.IUIAutomationElement;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -55,7 +55,7 @@ private static boolean isWindows() {
}

protected Logger logger =
LogManager.getLogger(AutomationControlFactoryTest.class.getName());
LoggerFactory.getLogger(AutomationControlFactoryTest.class.getName());

private AutomationBase parent;
private Element parentElement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import mmarquee.automation.UIAutomation;
import mmarquee.automation.pattern.ItemContainer;
import mmarquee.uiautomation.IUIAutomation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.junit.Test;
import org.mockito.Mockito;

Expand All @@ -33,7 +33,7 @@
*/
public class AutomationStatusBarTest {
protected Logger logger =
LogManager.getLogger(RadioButtonTest.class.getName());
LoggerFactory.getLogger(RadioButtonTest.class.getName());

@Test
public void testName_Gets_Name_From_Element() throws Exception {
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/mmarquee/automation/controls/DataGridTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import mmarquee.automation.pattern.Value;
import mmarquee.uiautomation.IUIAutomation;
import mmarquee.uiautomation.RowOrColumnMajor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
Expand All @@ -39,7 +39,7 @@
public class DataGridTest {

protected Logger logger =
LogManager.getLogger(DataGridTest.class.getName());
LoggerFactory.getLogger(DataGridTest.class.getName());

static {
ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/mmarquee/automation/controls/DataGridTest2.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import java.util.List;

import mmarquee.automation.Element;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Ignore;
Expand Down Expand Up @@ -55,7 +55,7 @@ private static boolean isWindows() {
}

protected Logger logger =
LogManager.getLogger(DataGridTest2.class.getName());
LoggerFactory.getLogger(DataGridTest2.class.getName());

static {
ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.PointerByReference;
import mmarquee.automation.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.junit.*;
import org.mockito.Mockito;

Expand Down Expand Up @@ -52,7 +52,7 @@ private static boolean isWindows() {
}

private Logger logger =
LogManager.getLogger(IUIAutomationTest.class.getName());
LoggerFactory.getLogger(IUIAutomationTest.class.getName());

static {
ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.PointerByReference;
import mmarquee.automation.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.junit.*;
import org.mockito.Mockito;

Expand Down Expand Up @@ -53,7 +53,7 @@ private static boolean isWindows() {
}

private Logger logger =
LogManager.getLogger(IUIAutomationTest.class.getName());
LoggerFactory.getLogger(IUIAutomationTest.class.getName());

static {
ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
Expand Down
Loading