Aspect Oriented Logging library for Java Applications.
com:
sejpalsaurabh:
logging:
common:
# Default Value : true
masking-enabled: true
# For Default Values Please See Section : Commonly masked Fields
# Below fields will be masked from all model classes annotated with @LogProperties
masked-fields:
- firstname
- lastname
- email
- sin
# Default Value : true
com.sejpalsaurabh.logging.common.masking-enabled=true
# For Default Values Please See Section : Commonly masked Fields
# Below fields will be masked from all model classes annotated with @LogProperties
com.sejpalsaurabh.logging.common.masked-fields=firstname, lastname, email, sin
Below fields will be masked if
- com.sejpalsaurabh.logging.common.masking-enabled=true
- com.sejpalsaurabh.logging.common.masked-fields property not configured explicitly.
These fields will be masked if they are declared as properties in the class annotated with @LogProperties
I am in the process of collecting more PII Fields, This list will be updated soon.
password, credit-card, phone, phone-number,
postalcode, address, username, passcode, sin,
firstname, lastname, street, city, province,
email, pincode, phonenumber, apartment, unit,
gender, dob, mobile, passport, company, organization, state
package com.example.api.controller;
import com.sejpalsaurabh.logging.annotation.EnableEntryExitLogger;
public class UserController {
@EnableEntryExitLogger
@RequestMapping("/users/{id}")
public UserDTO get(@PathVariable String id) {
logger.info("UserId : {}", id);
return new UserDTO();
}
}
Starting execution for method get() of UserController.
UserId : 638ab169c3423e459d3c06c7
Completed execution for method get() of UserController.
package com.example.api.controller;
import com.sejpalsaurabh.logging.annotation.EnableExecutionTimeLogger;
public class UserController {
@EnableExecutionTimeLogger
@RequestMapping("/users/{id}")
public UserDTO get(@PathVariable String id) {
logger.info("UserId : {}", id);
return new UserDTO();
}
}
Starting execution for method get() of UserController.
UserId : 638ab169c3423e459d3c06c7
Completed execution for method get() of UserController in 4 ms.
package com.example.model;
import com.sejpalsaurabh.logging.annotation.LogProperties;
@LogProperties
public class UserDTO {
// Fields Declarations
// Getters and Setters
// toString()
// equals() and hashCode()
}
if com.sejpalsaurabh.logging.common.masking-enabled=true
method createUser, class UserController, args : [[UserDTO { id = null, firstName = ********, lastName = ********, name = Nate Payne, gender = ********, genderShort = M, email = ********, sin = ********, phone = ********}]]
if com.sejpalsaurabh.logging.common.masking-enabled=false
method createUser, class UserController, args : [[UserDTO { id = null, firstName = John, lastName = Doe, name = John Doe, gender = Male, genderShort = M, email = [email protected], sin = 123-456-7890, phone = 1-123-456-7890}]]
- Variable Masking using Annotations.
- Method Level Annotation for Logging Arguments.
- Make library more configurable to get log patterns using properties.
- Disable Logger for Specific Environments.