Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6752759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:04:57+00:00 2026-05-26T13:04:57+00:00

I have been using the Spring RestTemplate for a while and I consistently hit

  • 0

I have been using the Spring RestTemplate for a while and I consistently hit a wall when I’am trying to debug it’s requests and responses. I’m basically looking to see the same things as I see when I use curl with the “verbose” option turned on. For example :

curl -v http://twitter.com/statuses/public_timeline.rss

Would display both the sent data and the received data (including the headers, cookies, etc.).

I have checked some related posts like :
How do I log response in Spring RestTemplate?
but I haven’t managed to solve this issue.

One way to do this would be to actually change the RestTemplate source code and add some extra logging statements there, but I would find this approach really a last resort thing. There should be some way to tell Spring Web Client/RestTemplate to log everything in a much friendlier way.

My goal would be to be able to do this with code like :

restTemplate.put("http://someurl", objectToPut, urlPathValues);

and then to get the same type of debug information (as I get with curl) in the log file or in the console.
I believe this would be extremely useful for anyone that uses the Spring RestTemplate and has problems. Using curl to debug your RestTemplate problems just doesn’t work (in some cases).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:04:57+00:00Added an answer on May 26, 2026 at 1:04 pm

    I finally found a way to do this in the right way.
    Most of the solution comes from
    How do I configure Spring and SLF4J so that I can get logging?

    It seems there are two things that need to be done :

    1. Add the following line in log4j.properties : log4j.logger.httpclient.wire=DEBUG
    2. Make sure spring doesn’t ignore your logging config

    The second issue happens mostly to spring environments where slf4j is used (as it was my case).
    As such, when slf4j is used make sure that the following two things happen :

    1. There is no commons-logging library in your classpath : this can be done by adding the exclusion descriptors in your pom :

              <exclusions><exclusion>
                  <groupId>commons-logging</groupId>
                  <artifactId>commons-logging</artifactId>
              </exclusion>
          </exclusions>
      
    2. The log4j.properties file is stored somewhere in the classpath where spring can find/see it. If you have problems with this, a last resort solution would be to put the log4j.properties file in the default package (not a good practice but just to see that things work as you expect)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using spring for a while as my IOC. It has also
I'm using Hibernate with Spring in my application. I have been consistently using detached
I am using spring MVC 3. I have been trying to access the attributes
I am new using spring 3 and have been stuck for a while on
We have been using CruiseControl for quite a while with NUnit and NAnt. For
This is crazy... been using Spring for a while but can't find something like
i have been using the spring mvc frameworks lately for a university project. Could
I am new to struts2, prior to this I have been using struts1.2, Spring
I'm pretty much a newb with spring-hibernate and I have been trying to make
I have been trying to create a Spring project that uses MyBatis for the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.