---
title: "Migrating Version 4.1 to 4.2"
description: "Learn about migrating from version 4.1.0 to 4.2.0"
url: https://docs.sentry.io/platforms/java/guides/log4j2/migration/4.1-to-4.2/
---

# Migrating Version 4.1 to 4.2 | Sentry for Log4j 2.x

## [Migrating from `io.sentry:sentry` `4.1.0` to `io.sentry:sentry` `4.2.0`](https://docs.sentry.io/platforms/java/guides/log4j2/migration/4.1-to-4.2/#migrating-from-iosentrysentry-410-to-iosentrysentry-420)

`operation` is now a required property of the `SentryTransaction` and `SentrySpan`. Whenever a transaction or span is started, the value for `operation` must be provided:

```java
Sentry.startTransaction("transaction-name", "operation-name");
```

### [Spring](https://docs.sentry.io/platforms/java/guides/log4j2/migration/4.1-to-4.2/#spring)

#### [RestTemplate instrumentation](https://docs.sentry.io/platforms/java/guides/log4j2/migration/4.1-to-4.2/#resttemplate-instrumentation)

Simplified `RestTemplate` instrumentation does not involve anymore setting `UriTemplateHandler` using `SentrySpanClientHttpRequestInterceptor`.

Code snippet adding Sentry `RestTemplate` instrumentation changed from:

```java
@Bean
RestTemplate restTemplate(IHub hub) {
  RestTemplate restTemplate = new RestTemplate();
  SentrySpanClientHttpRequestInterceptor sentryRestTemplateInterceptor = new SentrySpanClientHttpRequestInterceptor(hub);
  UriTemplateHandler templateHandler = restTemplate.getUriTemplateHandler();
  restTemplate.setUriTemplateHandler(sentryRestTemplateInterceptor.createUriTemplateHandler(templateHandler));
  restTemplate.setInterceptors(Collections.singletonList(sentryRestTemplateInterceptor));
  return restTemplate;
}
```

into:

```java
@Bean
RestTemplate restTemplate(IHub hub) {
  RestTemplate restTemplate = new RestTemplate();
  SentrySpanClientHttpRequestInterceptor sentryRestTemplateInterceptor = new SentrySpanClientHttpRequestInterceptor(hub);
  restTemplate.setInterceptors(Collections.singletonList(sentryRestTemplateInterceptor));
  return restTemplate;
}
```

#### [SentryExceptionResolver does not send handled errors by default](https://docs.sentry.io/platforms/java/guides/log4j2/migration/4.1-to-4.2/#sentryexceptionresolver-does-not-send-handled-errors-by-default)

To prevent `SentryExceptionResolver` from sending errors that have been already captured by `@ExceptionHandlers`, we've changed the order for `SentryExceptionResolver` to `1`.

Old behavior can be brought back by setting `exceptionResolverOrder` property on `@EnableSentry`:

```java
@EnableSentry(exceptionResolverOrder = -2147483648)
class CustomConfiguration {
  ...
}
```

### [Spring Boot](https://docs.sentry.io/platforms/java/guides/log4j2/migration/4.1-to-4.2/#spring-boot)

#### [SentryExceptionResolver does not send handled errors by default](https://docs.sentry.io/platforms/java/guides/log4j2/migration/4.1-to-4.2/#sentryexceptionresolver-does-not-send-handled-errors-by-default-1)

To prevent `SentryExceptionResolver` from sending errors that have been already captured by `@ExceptionHandlers`, we've changed the order for `SentryExceptionResolver` to `1`.

Old behavior can be brought back by setting a property `sentry.exception-resolver-order=-2147483648`

#### [`@SentryTransaction` `operation` is now required](https://docs.sentry.io/platforms/java/guides/log4j2/migration/4.1-to-4.2/#sentrytransaction-operation-is-now-required)

`@SentryTransaction` must have `operation` property provided.

```java
class MyComponent {

  @SentryTransaction(name = "transaction-name", operation = "operation-name")
  @Scheduled(fixedRate = 3 * 1000L)
  void execute() {
      ...
    }
}
```
