All the examples I've seen that use aspect oriented programming for logging either log just class, method name and duration, and if they log parameters and return values they simply use ToString(). I need to have more control over what is logged. For example I want to skip passwords, or in some cases log all properties of an object but in other cases just the id property. Any suggestions? I looked at AspectJ in Java and Unity interception in C# and could not find a solution.
Customized parameter logging when using aspect oriented programing
1.1k Views Asked by shoren At
1
There are 1 best solutions below
Related Questions in AOP
- pointcut execution for specific class constructor
- AOP pointcut expression for specific annotated variable
- Spring Boot -> AOP -> BeanCreationException
- Error in springs.xml , aspectj-autoproxy
- How to inject a logging statement before every catch block in java
- Maven compile aspectj using different jvm
- AspectJ compile issues, java8 lambda expression, switch statement
- Aspectj optional parameter binding
- ProceedingJoinPoint.proceed() fails with ClassCastException when run on new thread
- AOP @Around: return BAD_REQUEST response
- Self call AOP issue still persisting even after adding aspectj maven plugin for compile time weaving
- How does aspect influence static method in Spring?
- PostSharp: Applying Advice to External Type
- Multiple CachePut operations per Method Invocation in Spring Caching
- Spring - Aspectj is not getting applied over obfuscated(YGuard) binaries(jars)
Related Questions in ASPECTJ
- What are benefits of using Aspectj in Spring config, if aspectj can be used alone
- pointcut execution for specific class constructor
- AspectJ declaremixin with class level annotation not matching
- Create a pointcut based on annotation parameters
- Getting java.lang.ClassFormatError: Duplicate method name&signature in class file when implementing PERTHIS aspectJ implementation in Wildfly 8
- How to get the pointcut details in the aspect constructor
- Eclipse not compiling because of ClassNotFoundException
- Dependency Injection into Spring non-managed beans
- NodeEntity attributes are NULL after transaction closed when using AspectJ
- Why is aspectj weaving Aspects from my test folder into my source classes (as opposed to the test classes)?
- Aspectj: Pointcut on lambda expression
- How export Eclipse 3.7 rcp product with AspectJ support?
- aspectj within a maven plugin fails to call pointcut
- How to enable autowire support within unmanaged class in spring using aspectj?
- AspectJ pointcuts in Scala using SBT
Related Questions in UNITY-INTERCEPTION
- Customized parameter logging when using aspect oriented programing
- Can I get WebApi to work with IoC Aspects/Interceptor
- Using default constructor and parameterised constructor in unity c#
- How do I configure Unity 2.0 Policy Injection to use custom attribute matching rule in configuration file?
- Why is my custom call handler not called?
- Intercepting object with deep inheritance tree
- AOP interception attribute
- Full stack trace for intercepted methods at call site in Unity
- Use Unity to intercept all calls to IMyInterface.SomeMethod
- How to inject constructor parameter deep in the dependcies at runtime while resolving through unity
- VB.net Attributes on properties get and set
- Unity Interception Concept Clarity
- Difference between Arguments and Inputs in IMethodInvocation
- Unity Registration by Convention with Interface Interception
- How to make [HandlerAttribute]-based interception work on everything by default in Unity?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You could try introducing parameter annotations to augment your parameters with some attributes. One of those attributes could signal to skip logging the parameter, another one could be used to specify a converter class for the string representation.
With the following annotations:
the aspect could look like this:
Test code:
I used Java 8 Streams API in my answer for it's compactness, you could convert the code to normal Java code if you don't use Java 8 features or need better efficiency. It's just to give you an idea.