Updated parent in pom.xml and moved to log4j2

This commit is contained in:
Konstantina Galouni 2022-10-07 13:35:48 +03:00
parent 9bcf884a6d
commit 806a2365c3
21 changed files with 60 additions and 123 deletions

54
pom.xml
View File

@ -7,8 +7,8 @@
<name>uoa-admin-tools-library</name>
<parent>
<groupId>eu.dnetlib</groupId>
<artifactId>dnet45-parent</artifactId>
<version>1.0.0</version>
<artifactId>uoa-spring-boot-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<scm>
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/uoa-admin-tools-library/trunk</developerConnection>
@ -20,51 +20,11 @@
<timestampAdminToolsLibrary>${maven.build.timestamp}</timestampAdminToolsLibrary>
<maven.build.timestamp.format>E MMM dd HH:mm:ss z yyyy</maven.build.timestamp.format>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.5.8.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId> org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
@ -73,18 +33,10 @@
<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>uoa-authorization-library</artifactId>
<version>2.1.0</version>
<version>2.1.3-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
</plugins>
<finalName>uoa-admin-tools-library</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>

View File

@ -4,9 +4,9 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.*;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.*;
import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.MismatchingContentException;
import eu.dnetlib.uoaadmintoolslibrary.responses.SingleValueWrapperResponse;
import eu.dnetlib.uoaadmintoolslibrary.services.*;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
@ -20,7 +20,7 @@ import java.util.Set;
@RequestMapping(value = "{portalType}")
@CrossOrigin(origins = "*")
public class AdminPortalRelationsController {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private PortalService portalService;

View File

@ -3,7 +3,8 @@ package eu.dnetlib.uoaadmintoolslibrary.controllers;
import eu.dnetlib.uoaadmintoolslibrary.configuration.GlobalVars;
import eu.dnetlib.uoaadmintoolslibrary.configuration.properties.GoogleConfig;
import eu.dnetlib.uoaadmintoolslibrary.configuration.properties.MailConfig;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.CrossOrigin;
@ -27,7 +28,7 @@ public class AdminToolsLibraryCheckDeployController {
@Autowired
private GlobalVars globalVars;
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@RequestMapping(value = {"", "/health_check"}, method = RequestMethod.GET)
public String hello() {

View File

@ -1,13 +1,10 @@
package eu.dnetlib.uoaadmintoolslibrary.controllers;
import eu.dnetlib.uoaadmintoolslibrary.entities.DivHelpContent;
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.DivHelpContentResponse;
import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
import eu.dnetlib.uoaadmintoolslibrary.services.DivHelpContentService;
import eu.dnetlib.uoaadmintoolslibrary.services.PortalService;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -16,7 +13,7 @@ import java.util.List;
@RestController
@CrossOrigin(origins = "*")
public class DivHelpContentController {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private DivHelpContentService divHelpContentService;

View File

@ -1,12 +1,12 @@
package eu.dnetlib.uoaadmintoolslibrary.controllers;
import eu.dnetlib.uoaadmintoolslibrary.entities.DivId;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.DivIdResponse;
import eu.dnetlib.uoaadmintoolslibrary.services.DivIdService;
import java.util.*;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
@ -14,7 +14,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
@RestController
@CrossOrigin(origins = "*")
public class DivIdController {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private DivIdService divIdService;

View File

@ -4,7 +4,8 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.Entity;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PortalEntity;
import eu.dnetlib.uoaadmintoolslibrary.services.EntityService;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
@ -14,7 +15,7 @@ import java.util.List;
@RestController
@CrossOrigin(origins = "*")
public class EntityController {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private EntityService entityService;

View File

@ -3,7 +3,8 @@ package eu.dnetlib.uoaadmintoolslibrary.controllers;
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PortalResponse;
import eu.dnetlib.uoaadmintoolslibrary.services.PortalService;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -14,7 +15,7 @@ import java.util.List;
@RequestMapping("/portal")
@CrossOrigin(origins = "*")
public class GenericPortalController {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private PortalService portalService;

View File

@ -1,6 +1,5 @@
package eu.dnetlib.uoaadmintoolslibrary.controllers;
import com.mongodb.DuplicateKeyException;
import eu.dnetlib.uoaadmintoolslibrary.entities.Page;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PortalPage;
import eu.dnetlib.uoaadmintoolslibrary.handlers.ForbiddenException;
@ -8,18 +7,17 @@ import eu.dnetlib.uoaadmintoolslibrary.handlers.MismatchingContentException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.utils.RolesUtils;
import eu.dnetlib.uoaadmintoolslibrary.services.PageService;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
import javax.validation.constraints.Null;
import java.util.*;
@RestController
@CrossOrigin(origins = "*")
public class PageController {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private PageService pageService;

View File

@ -1,19 +1,16 @@
package eu.dnetlib.uoaadmintoolslibrary.controllers;
import eu.dnetlib.uoaadmintoolslibrary.entities.PageHelpContent;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PageHelpContentResponse;
import eu.dnetlib.uoaadmintoolslibrary.services.PageHelpContentService;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@CrossOrigin(origins = "*")
public class PageHelpContentController {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private PageHelpContentService pageHelpContentService;

View File

@ -3,8 +3,9 @@ package eu.dnetlib.uoaadmintoolslibrary.controllers;
import eu.dnetlib.uoaadmintoolslibrary.entities.*;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.*;
import eu.dnetlib.uoaadmintoolslibrary.services.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.*;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@ -14,7 +15,7 @@ import java.util.Map;
@RequestMapping(value = "{portalType}")
@CrossOrigin(origins = "*")
public class PortalController {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private PortalService portalService;

View File

@ -1,6 +1,7 @@
package eu.dnetlib.uoaadmintoolslibrary.emailSender;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.stereotype.Service;
@ -18,7 +19,7 @@ import eu.dnetlib.uoaadmintoolslibrary.configuration.properties.MailConfig;
@Configurable
public class EmailSender {
private static final Logger logger = Logger.getLogger(EmailSender.class);
private static final Logger logger = LogManager.getLogger(EmailSender.class);
@Autowired
private MailConfig mailConfig;

View File

@ -1,7 +1,8 @@
package eu.dnetlib.uoaadmintoolslibrary.handlers;
import eu.dnetlib.uoaadmintoolslibrary.responses.ExceptionResponse;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.data.crossstore.ChangeSetPersister;
import org.springframework.http.HttpStatus;
@ -12,7 +13,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
@ControllerAdvice
public class AdminToolsLibraryExceptionsHandler {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@ExceptionHandler(MissingServletRequestParameterException.class)
public ResponseEntity<ExceptionResponse> invalidInput(Exception ex) {

View File

@ -1,10 +1,11 @@
package eu.dnetlib.uoaadmintoolslibrary.handlers.utils;
import eu.dnetlib.uoaauthorizationlibrary.security.AuthorizationService;
import org.apache.log4j.Logger;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -13,7 +14,7 @@ public class RolesUtils {
@Autowired
private AuthorizationService authorizationService;
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
public List<String> getRoles() {
return authorizationService.getRoles();

View File

@ -1,6 +1,7 @@
package eu.dnetlib.uoaadmintoolslibrary.recaptcha;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.web.client.RestTemplateBuilder;
@ -19,7 +20,7 @@ import eu.dnetlib.uoaadmintoolslibrary.handlers.InvalidReCaptchaException;
@Service
@Configurable
public class VerifyRecaptcha {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private RestOperations restTemplate;

View File

@ -7,7 +7,8 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.DivIdResponse;
import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.MismatchingContentException;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -17,7 +18,7 @@ import java.util.List;
@Service
public class DivHelpContentService {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private DivHelpContentDAO divHelpContentDAO;

View File

@ -7,7 +7,8 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.DivHelpContentResponse;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.DivIdResponse;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -15,7 +16,7 @@ import java.util.*;
@Service
public class DivIdService {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private DivIdDAO divIdDAO;

View File

@ -6,7 +6,8 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.Page;
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PortalEntity;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -16,7 +17,7 @@ import java.util.Map;
@Service
public class EntityService {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private EntityDAO entityDAO;

View File

@ -9,7 +9,8 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PageHelpContentResp
import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.MismatchingContentException;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -18,7 +19,7 @@ import java.util.List;
@Service
public class PageHelpContentService {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private PageHelpContentDAO pageHelpContentDAO;

View File

@ -11,9 +11,9 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.PortalPage;
import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.ForbiddenException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.MismatchingContentException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.utils.RolesUtils;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -21,7 +21,7 @@ import java.util.*;
@Service
public class PageService {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private RolesUtils rolesUtils;

View File

@ -9,7 +9,8 @@ import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.*;
import eu.dnetlib.uoaadmintoolslibrary.handlers.ContentNotFoundException;
import eu.dnetlib.uoaadmintoolslibrary.handlers.MismatchingContentException;
import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -17,7 +18,7 @@ import java.util.*;
@Service
public class PortalService {
private final Logger log = Logger.getLogger(this.getClass());
private final Logger log = LogManager.getLogger(this.getClass());
@Autowired
private PortalDAO portalDAO;

View File

@ -1,20 +0,0 @@
log4j.rootLogger = DEBUG, R
log4j.logger.eu.dnetlib = DEBUG
log4j.logger.org.springframework = DEBUG, S
log4j.additivity.org.springframework = false
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=/var/log/dnet/uoa-admin-tools-library/uoa-admin-tools-library.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern= %d %p %t [%c] - %m%n
log4j.appender.S=org.apache.log4j.RollingFileAppender
log4j.appender.S.File=/var/log/dnet/uoa-admin-tools-library/uoa-admin-tools-library-spring.log
log4j.appender.S.MaxFileSize=10MB
log4j.appender.S.MaxBackupIndex=10
log4j.appender.S.layout=org.apache.log4j.PatternLayout
log4j.appender.S.layout.ConversionPattern= %d %p %t [%c] - %m%n