lenarbad / easylog Goto Github PK
View Code? Open in Web Editor NEWEasyLog is an open source library for logging/debugging in Java projects
License: MIT License
EasyLog is an open source library for logging/debugging in Java projects
License: MIT License
Make sure we don't miss any field (public, private and inherited)
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=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
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>
We should support Arrays
, Maps
, Enums
(maybe other?) on any level in objects.
The problem might show up if we use maskFields
because we go through all object's fields recursively
If there is any issue - fix it
Create an example for Spring projects to demonstrate how to use EasyLog in Spring projects
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
try .. catch
to isolate and catch all possible exceptions during processing.Create an example project to demonstrate how to use EasyLog in non-Spring projects
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
@LogIt
annotation in the same classupdate example projects once #40 is merged
@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 works great with method level. It would be nice to have logging at class level.
Figure out how to workaround that
Example:
WebApplicationException
should match ForbiddenException
, BadRequestException
, NotFoundException
etc
WebApplicationException
-> ClientErrorException
-> ForbiddenException
, BadRequestException
, NotFoundException
etc
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
Consider using only one annotation for everything
@LogIt
add new parameters
int attempts() default 2
- only one re-trylong delay() default 0
- delay in msClasses[] exceptions() default {}
Currently EasyLog supports only Spring projects from the box.
Need to figure out how to configure Maven to make non-Spring projects work with EasyLog.
Mojo's AspectJ Maven Plugin is a possible option or the only one.
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:
LogIt
to pass method parameter namesUpdate README.md for non-Spring projects once 1.1.3 is released
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.