ApiBoot Logging Admin visual interface management log

ApiBoot Logging Admin supports the interface to visually view the request log information. In the initial version, it supports the functions of viewing the service list and the latest link log of the reported log. It can also integrate Spring Security to configure the user name and password

Create Logging Admin project

We need to create a spring boot project and add the dependency and configuration information related to ApiBoot Logging Admin.

Original blog address: http://blog.yuqiyu.com/apiboot-logging-admin-visual-interface-management-log.html

Add dependency

Add the following dependencies to the pom.xml configuration file of the project:

  <!--Spring Web-->


  <!--ApiBoot Logging Admin-->

  <!--ApiBoot Mybatis Enhance-->
<!--Version dependency-->

Configure data sources

We need to connect to the database required by Logging Admin. Please visit[ Report the logs collected by ApiBoot Logging to Admin Look at it.

Modify the application.yml configuration file to add the relevant data source information as follows:

# Service name
    name: logging-admin
  # Data source related configuration
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/test
    username: root
    password: 123456
    type: com.zaxxer.hikari.HikariDataSource
# Service port number
  port: 8080

Configure log output & beautification

Modify the application.yml configuration file to add the configuration information related to ApiBoot Logging Admin, as shown below:

      # Logging Admin related configuration
        # The console displays the collected log information
        show-console-report-log: true
        # Beautification log
        format-console-log-json: true

Integrating Spring Security

When we integrate Spring Security, we directly access http://localhost:8080 You can view the visual interface provided by ApiBoot Logging Admin, but for security, we add Spring Security dependency and configure memory user information accordingly. Add dependency in pom.xml file as follows:

<!--Spring Security-->

Configure secure users

The spring boot starter security dependency provides memory mode configuration user information. The configuration user in the application.yml file is as follows:

# Service name
  # Integrate Spring Security and configure memory users
      name: admin
      password: admin123

Operation test

Start the project in this chapter by means of XxxApplication.

Access within browser http://localhost:8080 Address, the effect is as follows:

Because of the security interception of Spring Security, you will directly jump to the built-in login page of ApiBoot Logging Admin, and enter the user name and password configured in application.yml to log in.

Link log list

After successful login, you will jump to the link log list page, and click each link log line to expand the details, the effect is as follows:

Log service list

In the log service menu, you can view the basic information of each service, the time of the last report and the time of the first report, as shown in the following figure:

Knock on the blackboard

Currently, ApiBoot Logging Admin supports the visualization interface to view logs and basic service information. Its functions are still enriched and its integrity needs to be improved.

Code example

If you like this article, please point a Star for the source repository, thank you!!! The sample source code of this article can be obtained through the following ways. The directory is SpringBoot2.x/apiboot-logging-admin-visual-interface-management-log:

Author individual Blog Using open source framework ApiBoot Help you become Api interface service architect

Tags: Programming Spring MySQL xml Mybatis

Posted on Thu, 07 Nov 2019 02:55:27 -0500 by lip9000