Giter Club home page Giter Club logo

aop-logger's Introduction

aop-logger

AOP logger for Spring Boot applications.

Basic usage

Annotate method with @LogMethod to log name, input arguments and result of method invocation, or @Loggable for all methods of the component.

@Service
public class Service {

    @LogMethod
    public TestObject test(String name1, String name2, Integer integer) {
        TestObject testObject = new TestObject(
                1L,
                name1,
                new InnerTestObject(
                        2L,
                        name2
                )
        );

        return testObject;
    }
}

Log message:

com.dm4nk.aoptest.Service#test(name1="Outer", name2="Inner", integer=2): {"id":1,"name":"AOP","inner":{"id":2,"name":"none"}}


  • @LogMethod(logResult = false) skips result logging
  • @LogMethod(level = Level.INFO) changes level of aop-logger messages. Level.DEBUG is set by default
  • @Loggable(excludeMethods = true) skips logging of all methods not annotated with @IncludeLog
  • @ExcludeLog excludes method or method parameter from logging message

Include to your project

We will use jitpack.io project to get github repository as maven library.

Add to pom.xml

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
  <dependency>
      <groupId>com.github.dm4nk</groupId>
      <artifactId>aop-logger</artifactId>
      <version>1.1</version>
  </dependency>
</dependencies>

Add "com.dm4nk.aop.logger" to pakage scan.

@SpringBootApplication(
        scanBasePackages = {
                "com.dm4nk.aop.logger",
                "your.project.package"
        }
)
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

aop-logger's People

Contributors

dm4nk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.