Skip to content

Commit 48533f7

Browse files
authored
Make request for Logger explicit on current class (#1307)
1 parent b1c688d commit 48533f7

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

docs/core/logging.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ to customise what is logged.
239239
*/
240240
public class App implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
241241

242-
Logger log = LogManager.getLogger();
242+
Logger log = LogManager.getLogger(App.class);
243243

244244
@Logging
245245
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
@@ -256,7 +256,7 @@ to customise what is logged.
256256
*/
257257
public class AppLogEvent implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
258258

259-
Logger log = LogManager.getLogger();
259+
Logger log = LogManager.getLogger(AppLogEvent.class);
260260

261261
@Logging(logEvent = true)
262262
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
@@ -315,7 +315,7 @@ You can set a Correlation ID using `correlationIdPath` attribute by passing a [J
315315
*/
316316
public class App implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
317317

318-
Logger log = LogManager.getLogger();
318+
Logger log = LogManager.getLogger(App.class);
319319

320320
@Logging(correlationIdPath = "/headers/my_request_id_header")
321321
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
@@ -364,7 +364,7 @@ for known event sources, where either a request ID or X-Ray Trace ID are present
364364
*/
365365
public class App implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
366366

367-
Logger log = LogManager.getLogger();
367+
Logger log = LogManager.getLogger(App.class);
368368

369369
@Logging(correlationIdPath = CorrelationIdPathConstants.API_GATEWAY_REST)
370370
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
@@ -417,7 +417,7 @@ You can append your own keys to your existing logs via `appendKey`.
417417
*/
418418
public class App implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
419419

420-
Logger log = LogManager.getLogger();
420+
Logger log = LogManager.getLogger(App.class);
421421

422422
@Logging(logEvent = true)
423423
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
@@ -449,7 +449,7 @@ You can remove any additional key from entry using `LoggingUtils.removeKeys()`.
449449
*/
450450
public class App implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
451451

452-
Logger log = LogManager.getLogger();
452+
Logger log = LogManager.getLogger(App.class);
453453

454454
@Logging(logEvent = true)
455455
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
@@ -484,7 +484,7 @@ this means that custom keys can be persisted across invocations. If you want all
484484
*/
485485
public class App implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
486486

487-
Logger log = LogManager.getLogger();
487+
Logger log = LogManager.getLogger(App.class);
488488

489489
@Logging(clearState = true)
490490
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {
@@ -545,7 +545,7 @@ specific fields from received event due to security.
545545
*/
546546
public class App implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
547547

548-
Logger log = LogManager.getLogger();
548+
Logger log = LogManager.getLogger(App.class);
549549

550550
static {
551551
ObjectMapper objectMapper = new ObjectMapper();
@@ -575,7 +575,7 @@ via `samplingRate` attribute on annotation.
575575
*/
576576
public class App implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
577577

578-
Logger log = LogManager.getLogger();
578+
Logger log = LogManager.getLogger(App.class);
579579

580580
@Logging(samplingRate = 0.5)
581581
public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEvent input, final Context context) {

examples/powertools-examples-parameters/src/main/java/org/demo/parameters/ParametersFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import static software.amazon.lambda.powertools.parameters.transform.Transformer.json;
2424

2525
public class ParametersFunction implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
26-
private final static Logger log = LogManager.getLogger();
26+
private final static Logger log = LogManager.getLogger(ParametersFunction.class);
2727

2828
SSMProvider ssmProvider = ParamManager.getSsmProvider();
2929
SecretsProvider secretsProvider = ParamManager.getSecretsProvider();

powertools-idempotency/src/test/java/software/amazon/lambda/powertools/idempotency/handlers/IdempotencyFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import java.util.stream.Collectors;
2323

2424
public class IdempotencyFunction implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
25-
private final static Logger LOG = LogManager.getLogger();
25+
private final static Logger LOG = LogManager.getLogger(IdempotencyFunction.class);
2626

2727
public boolean handlerExecuted = false;
2828

0 commit comments

Comments
 (0)