Skip to content

Commit d8dafbc

Browse files
committed
Add DEBUG log message in MetadataExtractor
Closes gh-26130
1 parent cc4a1af commit d8dafbc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

spring-messaging/src/main/java/org/springframework/messaging/rsocket/DefaultMetadataExtractor.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import io.rsocket.metadata.CompositeMetadata;
3232
import io.rsocket.metadata.RoutingMetadata;
3333
import io.rsocket.metadata.WellKnownMimeType;
34+
import org.apache.commons.logging.Log;
35+
import org.apache.commons.logging.LogFactory;
3436

3537
import org.springframework.core.ParameterizedTypeReference;
3638
import org.springframework.core.ResolvableType;
@@ -52,6 +54,9 @@
5254
*/
5355
public class DefaultMetadataExtractor implements MetadataExtractor, MetadataExtractorRegistry {
5456

57+
private static final Log logger = LogFactory.getLog(DefaultMetadataExtractor.class);
58+
59+
5560
private final List<Decoder<?>> decoders;
5661

5762
private final Map<String, EntryExtractor<?>> registrations = new HashMap<>();
@@ -119,6 +124,10 @@ public Map<String, Object> extract(Payload payload, MimeType metadataMimeType) {
119124
else {
120125
extractEntry(payload.metadata().slice(), metadataMimeType.toString(), result);
121126
}
127+
if (logger.isDebugEnabled()) {
128+
logger.debug("Values extracted from metadata: " + result +
129+
" with registrations for " + this.registrations.keySet() + ".");
130+
}
122131
return result;
123132
}
124133

@@ -175,7 +184,7 @@ public void extract(ByteBuf content, Map<String, Object> result) {
175184

176185
@Override
177186
public String toString() {
178-
return "mimeType=" + this.mimeType + ", targetType=" + this.targetType;
187+
return "\"" + this.mimeType + "\" => " + this.targetType;
179188
}
180189
}
181190

0 commit comments

Comments
 (0)