Giter Club home page Giter Club logo

easylog's People

Contributors

lenarbad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

easylog's Issues

Create Signature class

Create the Signature class that should contain all method metadata
It should do all ProceedingJoinPoint/JoinPoint work to prevent duplicated calls and improve performance

logNulls is not applied to method parameters

logNulls=false works for returned objects

but doesn't work for method's parameter objects

Make sure logNulls=true should still log parameters even if parameter=null - it should be applied to parameter's fields

Support all Map's

Currently it supports only Map<String, Object>.
It causes unexpected errors like "can't cast Long to String"

Need to support all kinds of Map's:
Map<Object, Object>

Optimize Aspects related calls

As a possible option - create a full map for all the joint points that created by logging aspects.

We should create an instance of Signature during the first call for all joint points.

That will allow us to prevent all AspectJ calls after the first call. So the first log entry should be pretty heavy but then all following ones will be very light

BigInteger causes StackOverflow error

java.lang.StackOverflowError
	at java.math.MutableBigInteger.divideMagnitude(MutableBigInteger.java:1488)
	at java.math.MutableBigInteger.divideKnuth(MutableBigInteger.java:1227)
	at java.math.MutableBigInteger.divide(MutableBigInteger.java:1153)
	at java.math.MutableBigInteger.divide(MutableBigInteger.java:1147)
	at java.math.BigInteger.smallToString(BigInteger.java:3583)
	at java.math.BigInteger.toString(BigInteger.java:3549)
	at java.math.BigInteger.toString(BigInteger.java:3710)
	at java.lang.String.valueOf(String.java:2994)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at java.util.AbstractMap.toString(AbstractMap.java:536)
	at io.lenar.easy.log.support.Processor.processMap(Processor.java:85)
	at io.lenar.easy.log.support.Processor.processObject(Processor.java:35)
	at io.lenar.easy.log.support.Processor.processMap(Processor.java:89)
	at io.lenar.easy.log.support.Processor.processObject(Processor.java:35)
	at io.lenar.easy.log.support.Processor.processMap(Processor.java:89)
	at io.lenar.easy.log.support.Processor.processObject(Processor.java:35)
	at io.lenar.easy.log.support.Processor.processMap(Processor.java:89)
        ...

Most likely including BigInteger into "PRIMITIVE" will fix the issue

Support both class and method level annotations in the same class

Support both class and method level annotations in the same class

  • Provide a possibility to use both class and method level @LogIt annotation in the same class
  • Do not log the methods that have class and method annotations twice
  • Method level annotation has a higher priority

JsonSyntaxException if method returns List

    @LogIt(label = "ANOTHER WEB SERVICE")
    public List<ComplexObject> someMethod(String id, String anotherId) throws IOException {
        return Arrays.asList(
                new ComplexObject(
                        new Book("My Title", "My Author"),
                        new User("FirstName", "LastName", "Email")
                ));
    }

Fails with

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 2 column 4 path $[0]

	at com.google.gson.Gson.fromJson(Gson.java:900)
	at com.google.gson.Gson.fromJson(Gson.java:853)
	at com.google.gson.Gson.fromJson(Gson.java:802)
	at io.lenar.easy.log.support.LogSupport.getMap(LogSupport.java:95)
	at io.lenar.easy.log.support.LogSupport.objectToString(LogSupport.java:90)
	at io.lenar.easy.log.support.JoinPointLogger.logMethodReturn(JoinPointLogger.java:44)
	at io.lenar.easy.log.support.JoinPointLogger.logMethod(JoinPointLogger.java:25)
	at io.lenar.easy.log.EasyLogger.logItMethodLevel(EasyLogger.java:25)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629)

Logging at class level

Logging works great with method level. It would be nice to have logging at class level.

Support using parent exceptions for retries

Example:
WebApplicationException should match ForbiddenException, BadRequestException, NotFoundException etc

WebApplicationException -> ClientErrorException -> ForbiddenException, BadRequestException, NotFoundException etc

Allow to log objects as is (using toString)

Create a new annotation parameter
boolean asIs default false

If asIs is true then do not process objects - log all objects using their toString() method regardless any other parameters

Retries

add new parameters

  • int attempts() default 2 - only one re-try
  • long delay() default 0 - delay in ms
  • Classes[] exceptions() default {}

Solution for proper naming interface method parameters

Currently interface method parameters have not very informative names because interfaces have only parameter types information.

-> List public final ConmanWebService.getValues(String arg0, String arg1, String arg2)
arg2: "test"
arg1: "userWebService.auth.key"
arg0: "user"

Create a solution to set names for parameters
Available options:

  • Create a new parameter for LogIt to pass method parameter names
  • Create a new annotation on the method level
  • Create a new annotation on the method parameter level

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.