eclipse-arrowhead / core-java-spring

Eclipse Public License 2.0
26 stars 51 forks source link

log_all_request_and_response property has no effect #342

Closed awoSYS closed 1 year ago

awoSYS commented 2 years ago

Hi! I'd like to see detailed logs of my local ArrowHead cloud core systems, while trying to find out why my consumer can't find a registered provider.

Therefore, I've set log_all_request_and_response=true for all core systems.

However, that doesn't seem to have any effect, I only see logs as:

orchestrator            | 2021-10-08 13:22:46.890 ERROR cc665827f554 --- [.10-8441-exec-1] e.a.c.h.HttpService                      : UnavailableServerException occurred at https://ubuntu:8445/authorization/intracloud/check

Nothing else is being printed. How can I see more detailed logs?


Environment

My authorization.properties, for example:

############################################
###       APPLICATION PARAMETERS         ###
############################################

# Database connection (mandatory)
# Change the server timezone if neccessary
spring.datasource.url=jdbc:mysql://mysql:3306/arrowhead?serverTimezone=Europe/Budapest
spring.datasource.username=authorization
spring.datasource.password=hqZFUkuHxhekio3
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
# use true only for debugging
spring.jpa.show-sql=false
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.hibernate.ddl-auto=none

# Authorization web-server parameters
server.address=authorization
server.port=8445

domain.name=ubuntu
domain.port=8445

############################################
###       CUSTOM PARAMETERS              ###
############################################

# Name of the core system
core_system_name=AUTHORIZATION

# Show all request/response in debug log
log_all_request_and_response=true

# Service Registry web-server parameters (to register the Authorization services)
sr_address=serviceregistry
sr_port=8443

#Allow querying access to the authorization tables for application systems (true/false - only has effect in secure mode)
enable_auth_for_cloud=false

# Interface names has to follow this format <PROTOCOL>-<SECURITY>-<FORMAT>, where security can be SECURE or INSECURE and protocol and format must be a sequence of letters, numbers and underscore.
# A regexp checker will verify that. If this setting is set to true then the PROTOCOL and FORMAT must come from a predefined set.
use_strict_service_intf_name_verifier=false

############################################
###           SECURE MODE                ###
############################################

# configure secure mode

# Set this to false to disable https mode
server.ssl.enabled=true

server.ssl.key-store-type=PKCS12
server.ssl.key-store=file:/certificates/authorization.p12
server.ssl.key-store-password=123456
server.ssl.key-alias=authorization
server.ssl.key-password=123456
server.ssl.client-auth=need
server.ssl.trust-store-type=PKCS12
server.ssl.trust-store=file:/certificates/truststore.p12
server.ssl.trust-store-password=123456

#If true, http client does not check whether the hostname is match one of the server's SAN in its certificate
#Just for testing, DO NOT USE this feature in production environment
disable.hostname.verifier=true

I'm running the core services with docker-compose:

version: "3"

services:
  mysql:
    container_name: mysql
    image: mariadb:latest
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=THIS_WILL_BE_YOUR_CONTAINERS_ROOT_PW
      - MYSQL_DATABASE=arrowhead
    volumes:
      - ./data/mysql:/var/lib/mysql
      - ./sql:/docker-entrypoint-initdb.d
    ports:
      - 3306:3306/tcp
    # networks:
    #   - arrowhead

  serviceregistry:
    container_name: serviceregistry
    image: svetlint/serviceregistry:latest
    depends_on:
      - mysql
    volumes:
      # dont forget to change the route of the locally available config file
      # format is <file on your local machine, (change this!!!)>:<file location inside the container (don't change this part!!!)>
      - ./core_system_config/serviceregistry.properties:/serviceregistry/application.properties
      - ./certificates:/certificates
    # networks:
    #   - arrowhead
    ports:
      - 8443:8443

  authorization:
    container_name: authorization
    image: svetlint/authorization:latest
    depends_on:
      - mysql
      - serviceregistry
    volumes:
      - ./core_system_config/authorization.properties:/authorization/application.properties
      - ./certificates:/certificates
    # networks:
    #   - arrowhead
    ports:
      - 8445:8445

  orchestrator:
    container_name: orchestrator
    image: svetlint/orchestrator:latest
    depends_on:
      - mysql
      - serviceregistry
    volumes:
      - ./core_system_config/orchestrator.properties:/orchestrator/application.properties
      - ./certificates:/certificates
    # networks:
    #   - arrowhead
    ports:
      - 8441:8441

  eventhandler:
    container_name: eventhandler
    image: svetlint/eventhandler:latest
    depends_on:
      - mysql
      - serviceregistry
    volumes:
      - ./core_system_config/eventhandler.properties:/eventhandler/application.properties
      - ./certificates:/certificates
    # networks:
    #   - arrowhead
    ports:
      - 8455:8455

  gatekeeper:
    container_name: gatekeeper
    image: svetlint/gatekeeper:latest
    depends_on:
      - mysql
      - serviceregistry
    volumes:
      - ./core_system_config/gatekeeper.properties:/gatekeeper/application.properties
      - ./certificates:/certificates
    # networks:
    #   - arrowhead
    ports:
      - 8449:8449

  gateway:
    container_name: gateway
    image: svetlint/gateway:latest
    depends_on:
      - mysql
      - serviceregistry
    volumes:
      - ./core_system_config/gateway.properties:/gateway/application.properties
      - ./certificates:/certificates
    # networks:
    #   - arrowhead
    ports:
      - 8453:8453

  certificateauthority:
    container_name: certificateauthority
    image: svetlint/certificate-authority:latest
    depends_on:
      - mysql
    volumes:
      - ./core_system_config/certificateauthority.properties:/certificate-authority/application.properties
      - ./certificates:/certificates
    # networks:
    #   - arrowhead
    ports:
      - 8448:8448

Thanks for your help!

rbocsi commented 2 years ago

Hello!

You have to set the log level to DEBUG too to see the detailed logs. You have to edit the log4j2.xml files of the core systems. There is a line something like this in there: <Property name="CONSOLE_FILE_LEVEL">INFO</Property> Change INFO to DEBUG, and restart the core systems.

Unfortunately, I am not familiar with the Docker, so I don't know where you can find the log4j2.xml file in that environment. In the github, you can find it in the src/main/resources folder next to the application.properties

awoSYS commented 2 years ago

Cool, thanks! Will try that.

Would be nice to have access to logging verbosity in the Docker setup as well.