Skip to content

Commit b10e72b

Browse files
authored
Merge branch 'master' into dependabot-v2
2 parents 8b75e23 + 8c8f190 commit b10e72b

File tree

6 files changed

+70
-6
lines changed

6 files changed

+70
-6
lines changed

.github/pull_request_template.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Description of the change
2+
3+
> Description here
4+
## Type of change
5+
- [ ] Bug fix (non-breaking change that fixes an issue)
6+
- [ ] New feature (non-breaking change that adds functionality)
7+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
8+
9+
## Related issues
10+
11+
> Fix [#1]()
12+
## Checklists
13+
14+
### Development
15+
16+
- [ ] Lint rules pass locally
17+
- [ ] The code changed/added as part of this pull request has been covered with tests
18+
- [ ] All tests related to the changed code pass in development
19+
20+
### Code review
21+
22+
- [ ] This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
23+
- [ ] "Ready for review" label attached to the PR and reviewers mentioned in a comment
24+
- [ ] Changes have been reviewed by at least one other engineer
25+
- [ ] Issue from task tracker has a link to this pull request
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "Validate Gradle Wrapper"
2+
on: [push, pull_request]
3+
4+
jobs:
5+
validation:
6+
name: "Gradle wrapper validation"
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: gradle/wrapper-validation-action@v1

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION_NAME=1.7.4-SNAPSHOT
1+
VERSION_NAME=1.7.6-SNAPSHOT
22
GROUP=com.rollbar
33

44
POM_DESCRIPTION=For connecting your applications built on the JVM to Rollbar for Error Reporting

rollbar-log4j2/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ dependencies {
22
api project(':rollbar-java')
33

44
api group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.0'
5+
annotationProcessor 'org.apache.logging.log4j:log4j-core:2.11.0'
56
}

rollbar-logback/src/main/java/com/rollbar/logback/RollbarAppender.java

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ public class RollbarAppender extends AppenderBase<ILoggingEvent> {
3535

3636
private static final String CUSTOM_THREAD_NAME_KEY = "threadName";
3737

38+
private static final String CUSTOM_ARGUMENT_ARRAY_KEY = "argumentArray";
39+
40+
3841
private Rollbar rollbar;
3942

4043
private String accessToken;
@@ -215,6 +218,8 @@ private Map<String, Object> buildCustom(ILoggingEvent event) {
215218
custom.put(CUSTOM_MDC_NAME_KEY, this.buildMdc(event));
216219
custom.put(CUSTOM_MAKER_NAME_KEY, this.getMarker(event));
217220

221+
custom.put(CUSTOM_ARGUMENT_ARRAY_KEY, event.getArgumentArray());
222+
218223
Map<String, Object> rootCustom = new HashMap<>();
219224
rootCustom.put(CUSTOM_NAMESPACE_KEY, custom);
220225

rollbar-logback/src/test/java/com/rollbar/logback/RollbarAppenderTest.java

+28-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public class RollbarAppenderTest {
4444
static {
4545
MDC.put("mdc_key_1", "mdc_value_1");
4646
}
47-
4847
private static String NESTED_EXCEPTION_MESSAGE = "This is the nested exception message";
4948

5049
private static final Exception NESTED_EXCEPTION =
@@ -53,6 +52,7 @@ public class RollbarAppenderTest {
5352
private static final Exception EXCEPTION =
5453
new IllegalArgumentException(EXCEPTION_MESSAGE, NESTED_EXCEPTION);
5554

55+
private static final Object[] ARGUMENT_ARRAY = {"arg_1", 17};
5656
@Rule
5757
public MockitoRule rule = MockitoJUnit.rule();
5858

@@ -104,11 +104,12 @@ public void shouldLogEventWithAllInformationFromThrowableProxyWithThrowable() {
104104
when(event.getThrowableProxy()).thenReturn(rootThrowableProxy);
105105
when(event.getMDCPropertyMap()).thenReturn(MDC);
106106
when(event.getFormattedMessage()).thenReturn(FORMATTED_MESSAGE);
107+
when(event.getArgumentArray()).thenReturn(ARGUMENT_ARRAY);
107108

108109
sut.append(event);
109110

110111
Map<String, Object> expectedCustom = buildExpectedCustom(LOGGER_NAME,
111-
new HashMap<String, Object>(MDC), MARKER_NAME, THREAD_NAME);
112+
new HashMap<String, Object>(MDC), MARKER_NAME, THREAD_NAME, ARGUMENT_ARRAY);
112113

113114
verify(rollbar).log(rootThrowableWrapper, expectedCustom, FORMATTED_MESSAGE, Level.ERROR, false);
114115
}
@@ -121,11 +122,12 @@ public void shouldLogEventWhenNoMarker() {
121122
when(event.getThrowableProxy()).thenReturn(rootThrowableProxy);
122123
when(event.getMDCPropertyMap()).thenReturn(MDC);
123124
when(event.getFormattedMessage()).thenReturn(FORMATTED_MESSAGE);
125+
when(event.getArgumentArray()).thenReturn(ARGUMENT_ARRAY);
124126

125127
sut.append(event);
126128

127129
Map<String, Object> expectedCustom = buildExpectedCustom(LOGGER_NAME,
128-
new HashMap<String, Object>(MDC), null, THREAD_NAME);
130+
new HashMap<String, Object>(MDC), null, THREAD_NAME, ARGUMENT_ARRAY);
129131

130132
verify(rollbar).log(rootThrowableWrapper, expectedCustom, FORMATTED_MESSAGE, Level.ERROR, false);
131133
}
@@ -138,24 +140,45 @@ public void shouldLogEventWhenNoMDC() {
138140
when(event.getLevel()).thenReturn(ch.qos.logback.classic.Level.ERROR);
139141
when(event.getThrowableProxy()).thenReturn(rootThrowableProxy);
140142
when(event.getFormattedMessage()).thenReturn(FORMATTED_MESSAGE);
143+
when(event.getArgumentArray()).thenReturn(ARGUMENT_ARRAY);
144+
145+
sut.append(event);
146+
147+
Map<String, Object> expectedCustom = buildExpectedCustom(LOGGER_NAME,
148+
null, MARKER_NAME, THREAD_NAME, ARGUMENT_ARRAY);
149+
150+
verify(rollbar).log(rootThrowableWrapper, expectedCustom, FORMATTED_MESSAGE, Level.ERROR, false);
151+
}
152+
153+
@Test
154+
public void shouldLogEventWhenNoArgumentArray() {
155+
when(event.getLoggerName()).thenReturn(LOGGER_NAME);
156+
when(event.getMarker()).thenReturn(marker);
157+
when(event.getThreadName()).thenReturn(THREAD_NAME);
158+
when(event.getLevel()).thenReturn(ch.qos.logback.classic.Level.ERROR);
159+
when(event.getThrowableProxy()).thenReturn(rootThrowableProxy);
160+
when(event.getMDCPropertyMap()).thenReturn(MDC);
161+
when(event.getFormattedMessage()).thenReturn(FORMATTED_MESSAGE);
162+
when(event.getArgumentArray()).thenReturn(null);
141163

142164
sut.append(event);
143165

144166
Map<String, Object> expectedCustom = buildExpectedCustom(LOGGER_NAME,
145-
null, MARKER_NAME, THREAD_NAME);
167+
new HashMap<String, Object>(MDC), MARKER_NAME, THREAD_NAME, null);
146168

147169
verify(rollbar).log(rootThrowableWrapper, expectedCustom, FORMATTED_MESSAGE, Level.ERROR, false);
148170
}
149171

150172
private static Map<String, Object> buildExpectedCustom(String loggerName, Map<String, Object> mdc,
151-
String markerName, String threadName) {
173+
String markerName, String threadName, Object[] argumentArray) {
152174
Map<String, Object> rootCustom = new HashMap<>();
153175
Map<String, Object> custom = new HashMap<>();
154176

155177
custom.put("loggerName", loggerName);
156178
custom.put("threadName", threadName);
157179
custom.put("marker", markerName);
158180
custom.put("mdc", mdc);
181+
custom.put("argumentArray", argumentArray);
159182

160183
rootCustom.put("rollbar-logback", custom);
161184

0 commit comments

Comments
 (0)