Skip to content

Could not load logfile from actuator #741

Description

@daring2

Ostara cannot load logfile data from one of our application. The logfile tab shows the error:

Error loading data. Could not load logfile from actuator.

The application configured correctly, logfile endpoint works in browser. The application log contains the following errors related to Ostara requests:

Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation]

As I understand the problem occurs because Ostara does not use "Accept" header for logfile requests. Our application sets "ContentNegotiationConfigurer#defaultContentType" parameter to MediaType.APPLICATION_JSON and this type is used if "Accept" header is missing.

Stacktrace:

org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
	at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:249)
	at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:183)
	at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:78)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:135)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
...

Expected Behavior

Logfile data is loaded correctly.

Current Behavior

The logfile tab shows the error "Could not load logfile from actuator".

Steps to Reproduce

  1. Create an application with ContentNegotiationConfigurer#defaultContentType parameter.
  2. Connect to the application and open logfile tab.

Possible Solution

Add "Accept" header for logfile requests.

Environment

  • Ostara version: 0.12.0
  • Spring boot version: 2.7.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions