* #496 Add pipeline module to parent pom ✨ * #496: Add main application class and test for pipeline * #496: Checkstyle format and add log messages on pipeline stages 🎨 * #496: Fill readme sections of pipeline ✨ * #496: Javadocs and checkstyle formatting 🎨 * #496: Follow PMD checks and add more explanation as block comment on App.java * #496: Apply requested PR changes by iluwatar 🎨 * #970: Replace log4j usage on commander pattern to Slf4j API 🎨 * #970: Replace log4j usage on dao pattern to Slf4j API 🎨 * #970: Replace log4j usage on data mapper pattern to Slf4j API 🎨 * #970: Remove log4j dependency on data transfer object pom 🔥 * #970: Replace log4j usage on module pattern to Slf4j API 🎨 * #970: Replace log4j usage on serverless pattern to Slf4j API 🎨 This also removes the aws log4j dependency * #970: Remove unnecessary gitignore line for log4j.xml 🔥 * #970: Remove remaining remnants of log4j 🔥 * #970: Replace System.out logging with appropriate logging methods 🎨 * #970: Replace System.out method references to Logger::info 🎨
This commit is contained in:
committed by
Ilkka Seppälä
parent
72b174619f
commit
cfdfedbd2e
@ -60,11 +60,6 @@
|
||||
<artifactId>aws-lambda-java-events</artifactId>
|
||||
<version>${aws-lambda-java-events.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.amazonaws</groupId>
|
||||
<artifactId>aws-lambda-java-log4j</artifactId>
|
||||
<version>${aws-lambda-log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
|
@ -27,7 +27,10 @@ import com.amazonaws.services.lambda.runtime.RequestHandler;
|
||||
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
|
||||
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
|
||||
import com.iluwatar.serverless.baas.model.Person;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* find person from persons collection
|
||||
@ -36,13 +39,15 @@ import org.apache.log4j.Logger;
|
||||
public class FindPersonApiHandler extends AbstractDynamoDbHandler<Person>
|
||||
implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(FindPersonApiHandler.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(FindPersonApiHandler.class);
|
||||
private static final Integer SUCCESS_STATUS_CODE = 200;
|
||||
|
||||
@Override
|
||||
public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent apiGatewayProxyRequestEvent,
|
||||
Context context) {
|
||||
LOG.info(apiGatewayProxyRequestEvent.getPathParameters());
|
||||
Map<String, String> pathParameters = apiGatewayProxyRequestEvent.getPathParameters();
|
||||
pathParameters.keySet().stream().map(key -> key + "=" + pathParameters.get(key)).forEach(LOG::info);
|
||||
|
||||
Person person = this.getDynamoDbMapper().load(Person.class, apiGatewayProxyRequestEvent
|
||||
.getPathParameters().get("id"));
|
||||
|
||||
|
@ -27,7 +27,8 @@ import com.amazonaws.services.lambda.runtime.RequestHandler;
|
||||
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent;
|
||||
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
|
||||
import com.iluwatar.serverless.baas.model.Person;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -38,7 +39,7 @@ import java.io.IOException;
|
||||
public class SavePersonApiHandler extends AbstractDynamoDbHandler<Person>
|
||||
implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(SavePersonApiHandler.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SavePersonApiHandler.class);
|
||||
private static final Integer CREATED_STATUS_CODE = 201;
|
||||
private static final Integer BAD_REQUEST_STATUS_CODE = 400;
|
||||
|
||||
|
@ -27,8 +27,8 @@ import com.iluwatar.serverless.faas.ApiGatewayResponse;
|
||||
import com.amazonaws.services.lambda.runtime.Context;
|
||||
import com.amazonaws.services.lambda.runtime.RequestHandler;
|
||||
import com.iluwatar.serverless.faas.LambdaInfo;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -39,13 +39,12 @@ import java.util.Map;
|
||||
*/
|
||||
public class LambdaInfoApiHandler implements RequestHandler<Map<String, Object>, ApiGatewayResponse> {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(LambdaInfoApiHandler.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(LambdaInfoApiHandler.class);
|
||||
private static final Integer SUCCESS_STATUS_CODE = 200;
|
||||
|
||||
|
||||
@Override
|
||||
public ApiGatewayResponse handleRequest(Map<String, Object> input, Context context) {
|
||||
BasicConfigurator.configure();
|
||||
LOG.info("received: " + input);
|
||||
|
||||
return new ApiGatewayResponse
|
||||
|
@ -1,29 +0,0 @@
|
||||
#
|
||||
# The MIT License
|
||||
# Copyright © 2014-2019 Ilkka Seppälä
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
log = .
|
||||
log4j.rootLogger = DEBUG, LAMBDA
|
||||
|
||||
log4j.appender.LAMBDA=com.amazonaws.services.lambda.runtime.log4j.LambdaAppender
|
||||
log4j.appender.LAMBDA.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.LAMBDA.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} <%X{AWSRequestId}> %-5p %c:%L - %m%n
|
Reference in New Issue
Block a user