Skip to content

Commit

Permalink
Examples update
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Feb 12, 2024
1 parent 780c79a commit c599189
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
9 changes: 7 additions & 2 deletions example-testng-log4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.17.2</version>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>2.19.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.19.0</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class JsonLoggingTest {

private static final Logger LOGGER = LogManager.getLogger(JsonLoggingTest.class);
public static final String FILE_FOLDER_PATH = "src/test/resources/xml";
public static final String FILE_FOLDER_PATH = "src/main/resources/xml";
public static final String JSON_FILE_PATH = FILE_FOLDER_PATH + "/file.json";

@Test
Expand All @@ -41,7 +41,7 @@ public void logJsonFile() {
@Test
public void logRepMessage() throws IOException {
/* here we are logging some binary data as file (useful for selenium) */
File file = File.createTempFile("rp-test", ".json");
File file = AttachmentHelper.getFileFromResources(FILE_FOLDER_PATH, "file", "json");
LOGGER.info(new ObjectMessage(new ReportPortalMessage(file, "File message")));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public void logImageBase64() throws IOException {
}

private String getImageResource(boolean lucky) {
return "pug/" + (lucky ? "lucky.jpg" : "unlucky.jpg");
return "src/main/resources/pug/" + (lucky ? "lucky.jpg" : "unlucky.jpg");
}
}
12 changes: 5 additions & 7 deletions example-testng-log4j/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@
<Configuration status="WARN">
<Appenders>
<Console name="ConsoleAppender" target="SYSTEM_OUT">
<PatternLayout
pattern="%d [%t] %-5level %logger{36} - %msg%n%throwable"/>
<PatternLayout pattern="%d [%t] %-5level %logger{36} - %msg%n%throwable"/>
</Console>
<ReportPortalLog4j2Appender name="ReportPortalAppender">
<PatternLayout
pattern="%d [%t] %-5level %logger{36} - %msg%n%throwable"/>
<PatternLayout pattern="%logger{36} - %msg%n%throwable"/>
</ReportPortalLog4j2Appender>
</Appenders>
<Loggers>
<Root level="INFO">
<Root level="WARN">
<AppenderRef ref="ConsoleAppender"/>
<AppenderRef ref="ReportPortalAppender"/>
</Root>
<Logger name="com.epam.reportportal" level="INFO" additivity="false">
<Logger name="com.epam.reportportal.example" level="TRACE" additivity="false">
<AppenderRef ref="ConsoleAppender"/>
<AppenderRef ref="ReportPortalAppender"/>
</Logger>
<Logger name="binary_data_logger" level="DEBUG" additivity="false">
<Logger name="binary_data_logger" level="TRACE" additivity="false">
<AppenderRef ref="ReportPortalAppender"/>
</Logger>
</Loggers>
Expand Down

0 comments on commit c599189

Please sign in to comment.