diff --git a/backend/build.gradle b/backend/build.gradle index 604a7adcf..6c91ff949 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -49,6 +49,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-webflux' implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-log4j2' + implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' implementation 'org.modelmapper:modelmapper:3.1.1' implementation 'org.springframework.boot:spring-boot-starter-mail' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' diff --git a/backend/src/main/java/org/ftclub/cabinet/cabinet/controller/AdminCabinetController.java b/backend/src/main/java/org/ftclub/cabinet/cabinet/controller/AdminCabinetController.java index 13889592b..6bcc99d9a 100644 --- a/backend/src/main/java/org/ftclub/cabinet/cabinet/controller/AdminCabinetController.java +++ b/backend/src/main/java/org/ftclub/cabinet/cabinet/controller/AdminCabinetController.java @@ -49,9 +49,6 @@ public class AdminCabinetController { @AuthGuard(level = AuthLevel.ADMIN_ONLY) public CabinetInfoResponseDto getCabinetInfo( @PathVariable("cabinetId") Long cabinetId) { - if (cabinetId == null) { - throw new ControllerException(ExceptionStatus.INCORRECT_ARGUMENT); - } log.info("Called getCabinetInfo: {}", cabinetId); return cabinetFacadeService.getCabinetInfo(cabinetId); } @@ -68,11 +65,11 @@ public CabinetInfoResponseDto getCabinetInfo( public void updateCabinetStatusNote( @PathVariable("cabinetId") Long cabinetId, @RequestBody HashMap body) { - if (cabinetId == null || body == null || body.isEmpty() || !body.containsKey( + log.info("Called updateCabinetStatusNote: {}", cabinetId); + if (body == null || body.isEmpty() || !body.containsKey( "statusNote")) { throw new ControllerException(ExceptionStatus.INCORRECT_ARGUMENT); } - log.info("Called updateCabinetStatusNote: {}", cabinetId); cabinetFacadeService.updateCabinetStatusNote(cabinetId, body.get("statusNote")); } @@ -88,10 +85,10 @@ public void updateCabinetStatusNote( public void updateCabinetTitle( @PathVariable("cabinetId") Long cabinetId, @RequestBody HashMap body) { - if (cabinetId == null || body == null || body.isEmpty() || !body.containsKey("title")) { + log.info("Called updateCabinetTitle: {}", cabinetId); + if (body == null || body.isEmpty() || !body.containsKey("title")) { throw new ControllerException(ExceptionStatus.INCORRECT_ARGUMENT); } - log.info("Called updateCabinetTitle: {}", cabinetId); cabinetFacadeService.updateCabinetTitle(cabinetId, body.get("title")); } @@ -99,7 +96,7 @@ public void updateCabinetTitle( @AuthGuard(level = AuthLevel.ADMIN_ONLY) public void updateCabinetBundleStatus( @Valid @RequestBody CabinetStatusRequestDto cabinetStatusRequestDto) { - log.info("Called updateCabinetBundleStatus: {}", cabinetStatusRequestDto); + log.info("Called updateCabinetBundleStatus: {}", cabinetStatusRequestDto.getCabinetIds()); cabinetFacadeService.updateCabinetBundleStatus(cabinetStatusRequestDto); } @@ -107,7 +104,7 @@ public void updateCabinetBundleStatus( @AuthGuard(level = AuthLevel.ADMIN_ONLY) public void updateCabinetClubStatus( @Valid @RequestBody CabinetClubStatusRequestDto cabinetClubStatusRequestDto) { - log.info("Called updateCabinetClubStatus: {}", cabinetClubStatusRequestDto); + log.info("Called updateCabinetClubStatus: {}", cabinetClubStatusRequestDto.getCabinetId()); cabinetFacadeService.updateCabinetClubStatus(cabinetClubStatusRequestDto); lentFacadeService.startLentClubCabinet(cabinetClubStatusRequestDto.getUserId(), cabinetClubStatusRequestDto.getCabinetId()); @@ -126,12 +123,11 @@ public void updateCabinetClubStatus( public void updateCabinetGrid( @PathVariable("cabinetId") Long cabinetId, @RequestBody Map body) { - - if (cabinetId == null || body == null || body.isEmpty() || !body.containsKey("row") + log.info("Called updateCabinetGrid: {}", cabinetId); + if (body == null || body.isEmpty() || !body.containsKey("row") || !body.containsKey("col")) { throw new ControllerException(ExceptionStatus.INCORRECT_ARGUMENT); } - log.info("Called updateCabinetGrid: {}", cabinetId); cabinetFacadeService.updateCabinetGrid(cabinetId, body.get("row"), body.get("col")); } @@ -147,11 +143,11 @@ public void updateCabinetGrid( public void updateCabinetVisibleNum( @PathVariable("cabinetId") Long cabinetId, @RequestBody HashMap body) { - if (cabinetId == null || body == null || body.isEmpty() || !body.containsKey( + log.info("Called updateCabinetVisibleNum: {}", cabinetId); + if (body == null || body.isEmpty() || !body.containsKey( "visibleNum")) { throw new ControllerException(ExceptionStatus.INCORRECT_ARGUMENT); } - log.info("Called updateCabinetVisibleNum: {}", cabinetId); cabinetFacadeService.updateCabinetVisibleNum(cabinetId, body.get("visibleNum")); } @@ -167,7 +163,7 @@ public void updateCabinetVisibleNum( // public void updateCabinetBundleStatus( // @Valid @RequestBody UpdateCabinetsRequestDto updateCabinetsRequestDto, // @PathVariable("status") CabinetStatus status) { -// log.info("Called updateCabinetBundleStatus: {}", status); +// log.debug("Called updateCabinetBundleStatus: {}", status); // cabinetFacadeService.updateCabinetBundleStatus(updateCabinetsRequestDto, status); // } @@ -203,9 +199,7 @@ public CabinetPaginationDto getCabinetsByLentType( @PathVariable("lentType") LentType lentType, @RequestParam("page") Integer page, @RequestParam("size") Integer size) { - if (lentType == null) { - throw new ControllerException(ExceptionStatus.INCORRECT_ARGUMENT); - } + log.info("Called getCabinetsByLentType: {}", lentType); return cabinetFacadeService.getCabinetPaginationByLentType(lentType, page, size); } @@ -223,9 +217,7 @@ public CabinetPaginationDto getCabinetsByStatus( @PathVariable("status") CabinetStatus status, @RequestParam("page") Integer page, @RequestParam("size") Integer size) { - if (status == null) { - throw new ControllerException(ExceptionStatus.INCORRECT_ARGUMENT); - } + log.info("Called getCabinetsByStatus: {}", status); return cabinetFacadeService.getCabinetPaginationByStatus(status, page, size); } @@ -243,9 +235,7 @@ public CabinetPaginationDto getCabinetsByVisibleNum( @PathVariable("visibleNum") Integer visibleNum, @RequestParam("page") Integer page, @RequestParam("size") Integer size) { - if (visibleNum == null) { - throw new ControllerException(ExceptionStatus.INCORRECT_ARGUMENT); - } + log.info("Called getCabinetsByVisibleNum: {}", visibleNum); return cabinetFacadeService.getCabinetPaginationByVisibleNum(visibleNum, page, size); } @@ -263,9 +253,7 @@ public LentHistoryPaginationDto getCabinetLentHistories(@Valid @PathVariable("cabinetId") Long cabinetId, @RequestParam("page") Integer page, @RequestParam("size") Integer size) { - if (cabinetId == null) { - throw new ControllerException(ExceptionStatus.INCORRECT_ARGUMENT); - } + log.info("Called getCabinetLentHistories: {}", cabinetId); return cabinetFacadeService.getCabinetLentHistoriesPagination(cabinetId, page, size); } diff --git a/backend/src/main/java/org/ftclub/cabinet/cabinet/controller/CabinetController.java b/backend/src/main/java/org/ftclub/cabinet/cabinet/controller/CabinetController.java index fc1d76b1d..a1e09a768 100644 --- a/backend/src/main/java/org/ftclub/cabinet/cabinet/controller/CabinetController.java +++ b/backend/src/main/java/org/ftclub/cabinet/cabinet/controller/CabinetController.java @@ -53,10 +53,7 @@ public List getBuildingFloorsResponse() { public List getCabinetsPerSection( @PathVariable("building") String building, @PathVariable("floor") Integer floor) { - if (building == null || floor == null) { - throw new ControllerException(ExceptionStatus.INCORRECT_ARGUMENT); - } - log.info("Called getCabinetsPerSection"); + log.info("Called getCabinetsPerSection building : {} floor : {}", building, floor); return cabinetFacadeService.getCabinetsPerSection(building, floor); } @@ -71,10 +68,7 @@ public List getCabinetsPerSection( @AuthGuard(level = AuthLevel.USER_OR_ADMIN) public CabinetInfoResponseDto getCabinetInfo( @PathVariable("cabinetId") Long cabinetId) { - if (cabinetId == null) { - throw new ControllerException(ExceptionStatus.INCORRECT_ARGUMENT); - } - log.info("Called getCabinetInfo"); + log.info("Called getCabinetInfo {}", cabinetId); return cabinetFacadeService.getCabinetInfo(cabinetId); } } diff --git a/backend/src/main/java/org/ftclub/cabinet/cabinet/domain/Cabinet.java b/backend/src/main/java/org/ftclub/cabinet/cabinet/domain/Cabinet.java index 3022431ee..3cd97681c 100644 --- a/backend/src/main/java/org/ftclub/cabinet/cabinet/domain/Cabinet.java +++ b/backend/src/main/java/org/ftclub/cabinet/cabinet/domain/Cabinet.java @@ -20,6 +20,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.ToString; +import lombok.extern.log4j.Log4j2; import org.ftclub.cabinet.exception.DomainException; import org.ftclub.cabinet.lent.domain.LentHistory; import org.ftclub.cabinet.utils.ExceptionUtil; @@ -39,6 +40,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter @ToString(exclude = {"cabinetPlace", "lentHistories"}) +@Log4j2 public class Cabinet { @Id @@ -148,45 +150,54 @@ public boolean isCabinetPlace(CabinetPlace cabinetPlace) { } public void specifyCabinetPlace(CabinetPlace cabinetPlace) { + log.info("setCabinetPlace : {}", cabinetPlace); this.cabinetPlace = cabinetPlace; } public void assignVisibleNum(Integer visibleNum) { + log.info("assignVisibleNum : {}", visibleNum); this.visibleNum = visibleNum; ExceptionUtil.throwIfFalse(this.isValid(), new DomainException(INVALID_STATUS)); } public void specifyStatus(CabinetStatus cabinetStatus) { + log.info("specifyStatus : {}", cabinetStatus); this.status = cabinetStatus; ExceptionUtil.throwIfFalse(this.isValid(), new DomainException(INVALID_STATUS)); } public void specifyMaxUser(Integer maxUser) { + log.info("specifyMaxUser : {}", maxUser); this.maxUser = maxUser; ExceptionUtil.throwIfFalse(this.isValid(), new DomainException(INVALID_STATUS)); } public void writeStatusNote(String statusNote) { + log.info("writeStatusNote : {}", statusNote); this.statusNote = statusNote; ExceptionUtil.throwIfFalse(this.isValid(), new DomainException(INVALID_STATUS)); } public void specifyLentType(LentType lentType) { + log.info("specifyLentType : {}", lentType); this.lentType = lentType; ExceptionUtil.throwIfFalse(this.isValid(), new DomainException(INVALID_STATUS)); } public void writeTitle(String title) { + log.info("writeTitle : {}", title); this.title = title; ExceptionUtil.throwIfFalse(this.isValid(), new DomainException(INVALID_STATUS)); } public void coordinateGrid(Grid grid) { + log.info("coordinateGrid : {}", grid); this.grid = grid; ExceptionUtil.throwIfFalse(this.isValid(), new DomainException(INVALID_STATUS)); } public void writeMemo(String memo) { + log.info("writeMemo : {}", memo); this.memo = memo; ExceptionUtil.throwIfFalse(this.isValid(), new DomainException(INVALID_STATUS)); } @@ -213,6 +224,7 @@ public int hashCode() { * @param userCount 현재 사용자 수 */ public void specifyStatusByUserCount(Integer userCount) { + log.info("specifyStatusByUserCount : {}", userCount); if (this.status.equals(CabinetStatus.BROKEN)) { throw new DomainException(INVALID_STATUS); } @@ -230,4 +242,4 @@ public void specifyStatusByUserCount(Integer userCount) { } } } -} \ No newline at end of file +} diff --git a/backend/src/main/java/org/ftclub/cabinet/cabinet/repository/CabinetOptionalFetcher.java b/backend/src/main/java/org/ftclub/cabinet/cabinet/repository/CabinetOptionalFetcher.java index bc6233897..1321827c3 100644 --- a/backend/src/main/java/org/ftclub/cabinet/cabinet/repository/CabinetOptionalFetcher.java +++ b/backend/src/main/java/org/ftclub/cabinet/cabinet/repository/CabinetOptionalFetcher.java @@ -35,12 +35,12 @@ public class CabinetOptionalFetcher { /*-------------------------------------------FIND-------------------------------------------*/ public Cabinet findCabinet(Long cabinetId) { - log.info("Called findCabinet: {}", cabinetId); + log.debug("Called findCabinet: {}", cabinetId); return cabinetRepository.findById(cabinetId).orElse(null); } public List findCabinetsActiveLentHistoriesByBuildingAndFloor(String building, Integer floor) { - log.info("Called findCabinetsActiveLentHistoriesByBuildingAndFloor: {}, {}", building, floor); + log.debug("Called findCabinetsActiveLentHistoriesByBuildingAndFloor: {}, {}", building, floor); return cabinetRepository.findCabinetActiveLentHistoryUserListByBuildingAndFloor(building, floor).stream() .map(result -> { Cabinet cabinet = (Cabinet) result[0]; @@ -58,23 +58,23 @@ public List findCabinetsActiveLentHistoriesByBuilding * @throws ServiceException 사물함을 찾을 수 없는 경우 */ public Cabinet findLentCabinetByUserId(Long userId) { - log.info("Called findLentCabinetByUserId: {}", userId); + log.debug("Called findLentCabinetByUserId: {}", userId); return cabinetRepository.findLentCabinetByUserId(userId).orElse(null); } public List findAllBuildings() { - log.info("Called findAllBuildings"); + log.debug("Called findAllBuildings"); return cabinetRepository.findAllBuildings(); } public List findAllFloorsByBuilding(String building) { - log.info("Called findAllFloorsByBuilding: {}", building); + log.debug("Called findAllFloorsByBuilding: {}", building); return cabinetRepository.findAllFloorsByBuilding(building); } // deprecated public List findAllSectionsByBuildingAndFloor(String building, Integer floor) { - log.info("Called findAllSectionsByBuildingAndFloor: {}, {}", building, floor); + log.debug("Called findAllSectionsByBuildingAndFloor: {}, {}", building, floor); return cabinetRepository.findAllSectionsByBuildingAndFloor(building, floor); } @@ -90,7 +90,7 @@ public List findAllSectionsByBuildingAndFloor(String building, Integer f * @throws ServiceException 사물함을 찾을 수 없는 경우 */ public Cabinet getCabinetForUpdate(Long cabinetId) { - log.info("Called getCabinetForUpdate: {}", cabinetId); + log.debug("Called getCabinetForUpdate: {}", cabinetId); return cabinetRepository.findByIdForUpdate(cabinetId) .orElseThrow(() -> new ServiceException(ExceptionStatus.NOT_FOUND_CABINET)); } @@ -103,7 +103,7 @@ public Cabinet getCabinetForUpdate(Long cabinetId) { * @throws ServiceException 사물함을 찾을 수 없는 경우 */ public Cabinet getCabinet(Long cabinetId) { - log.info("Called getCabinet: {}", cabinetId); + log.debug("Called getCabinet: {}", cabinetId); return cabinetRepository.findById(cabinetId) .orElseThrow(() -> new ServiceException(ExceptionStatus.NOT_FOUND_CABINET)); } @@ -116,7 +116,7 @@ public Cabinet getCabinet(Long cabinetId) { * @throws ServiceException 사물함을 찾을 수 없는 경우 */ public Cabinet getLentCabinetByUserId(Long userId) { - log.info("Called getLentCabinetByUserId: {}", userId); + log.debug("Called getLentCabinetByUserId: {}", userId); return cabinetRepository.findLentCabinetByUserId(userId) .orElseThrow(() -> new ServiceException(ExceptionStatus.NOT_FOUND_CABINET)); } @@ -129,7 +129,7 @@ public Cabinet getLentCabinetByUserId(Long userId) { * @throws ServiceException 사물함을 찾을 수 없는 경우 */ public Cabinet getClubCabinet(Long cabinetId) { - log.info("Called getClubCabinet: {}", cabinetId); + log.debug("Called getClubCabinet: {}", cabinetId); Cabinet cabinet = getCabinet(cabinetId); if (!cabinet.isLentType(LentType.CLUB)) { throw new ServiceException(ExceptionStatus.NOT_FOUND_CABINET); @@ -145,28 +145,28 @@ public Cabinet getClubCabinet(Long cabinetId) { * @throws ServiceException 사물함을 찾을 수 없는 경우 */ public Location getLocation(Long cabinetId) { - log.info("Called getLocation: {}", cabinetId); + log.debug("Called getLocation: {}", cabinetId); return cabinetRepository.findLocationById(cabinetId) .orElseThrow(() -> new ServiceException(ExceptionStatus.NOT_FOUND_CABINET)); } public Page findPaginationByLentType(LentType lentType, PageRequest pageable) { - log.info("Called findPaginationByLentType: {}", lentType); + log.debug("Called findPaginationByLentType: {}", lentType); return cabinetRepository.findPaginationByLentType(lentType, pageable); } public Page findPaginationByStatus(CabinetStatus status, PageRequest pageable) { - log.info("Called findPaginationByStatus: {}", status); + log.debug("Called findPaginationByStatus: {}", status); return cabinetRepository.findPaginationByStatus(status, pageable); } public Page findPaginationByVisibleNum(Integer visibleNum, PageRequest pageable) { - log.info("Called findPaginationByVisibleNum: {}", visibleNum); + log.debug("Called findPaginationByVisibleNum: {}", visibleNum); return cabinetRepository.findPaginationByVisibleNum(visibleNum, pageable); } public List findAllCabinetsByLocation(Location location) { - log.info("Called findAllCabinetsByLocation: {}", location); + log.debug("Called findAllCabinetsByLocation: {}", location); return cabinetRepository.findAllCabinetsByLocation(location); } diff --git a/backend/src/main/java/org/ftclub/cabinet/cabinet/service/CabinetFacadeServiceImpl.java b/backend/src/main/java/org/ftclub/cabinet/cabinet/service/CabinetFacadeServiceImpl.java index c562840c5..32116a21e 100644 --- a/backend/src/main/java/org/ftclub/cabinet/cabinet/service/CabinetFacadeServiceImpl.java +++ b/backend/src/main/java/org/ftclub/cabinet/cabinet/service/CabinetFacadeServiceImpl.java @@ -43,7 +43,7 @@ public class CabinetFacadeServiceImpl implements CabinetFacadeService { @Override @Transactional(readOnly = true) public List getBuildingFloorsResponse() { - log.info("getBuildingFloorsResponse"); + log.debug("getBuildingFloorsResponse"); return cabinetOptionalFetcher.findAllBuildings().stream() .map(building -> { List floors = cabinetOptionalFetcher.findAllFloorsByBuilding(building); @@ -58,7 +58,7 @@ public List getBuildingFloorsResponse() { @Override @Transactional(readOnly = true) public CabinetInfoResponseDto getCabinetInfo(Long cabinetId) { - log.info("getCabinetInfo"); + log.debug("getCabinetInfo"); List lentDtos = new ArrayList<>(); List lentHistories = lentOptionalFetcher.findAllActiveLentByCabinetId( cabinetId); @@ -76,7 +76,7 @@ public CabinetInfoResponseDto getCabinetInfo(Long cabinetId) { @Override @Transactional(readOnly = true) public CabinetSimplePaginationDto getCabinetsSimpleInfoByVisibleNum(Integer visibleNum) { - log.info("getCabinetsSimpleInfoByVisibleNum"); + log.debug("getCabinetsSimpleInfoByVisibleNum"); PageRequest page = PageRequest.of(0, Integer.MAX_VALUE); Page allCabinetsByVisibleNum = cabinetOptionalFetcher.findPaginationByVisibleNum( visibleNum, page); @@ -92,6 +92,7 @@ public CabinetSimplePaginationDto getCabinetsSimpleInfoByVisibleNum(Integer visi @Override @Transactional(readOnly = true) public List getCabinetsPerSection(String building, Integer floor) { + log.debug("getCabinetsPerSection"); List currentLentCabinets = cabinetOptionalFetcher.findCabinetsActiveLentHistoriesByBuildingAndFloor(building, floor); List allCabinetsByBuildingAndFloor = cabinetOptionalFetcher.findAllCabinetsByBuildingAndFloor(building, floor); @@ -115,7 +116,6 @@ public List getCabinetsPerSection(String building if (!cabinetLentHistories.containsKey(cabinet)) { String section = cabinet.getCabinetPlace().getLocation().getSection(); CabinetPreviewDto preview = createCabinetPreviewDto(cabinet, Collections.emptyList()); - System.out.println("preview = " + preview); if (cabinetPreviewsBySection.containsKey(section)) { cabinetPreviewsBySection.get(section).add(preview); } else { @@ -148,7 +148,7 @@ private CabinetPreviewDto createCabinetPreviewDto(Cabinet cabinet, List getCabinetInfoBundle(List cabinetIds) { - log.info("getCabinetInfoBundle"); + log.debug("getCabinetInfoBundle"); List result = new ArrayList<>(); for (Long cabinetId : cabinetIds) { CabinetInfoResponseDto cabinetInfo = getCabinetInfo(cabinetId); @@ -250,7 +250,7 @@ public List getCabinetInfoBundle(List cabinetIds) @Override @Transactional(readOnly = true) public CabinetInfoPaginationDto getCabinetsInfo(Integer visibleNum) { - log.info("getCabinetsInfo"); + log.debug("getCabinetsInfo"); PageRequest page = PageRequest.of(0, Integer.MAX_VALUE); Page allCabinetsByVisibleNum = cabinetOptionalFetcher.findPaginationByVisibleNum( visibleNum, page); @@ -269,7 +269,7 @@ public CabinetInfoPaginationDto getCabinetsInfo(Integer visibleNum) { */ private List generateLentHistoryDtoList( List lentHistories) { - log.info("generateLentHistoryDtoList"); + log.debug("generateLentHistoryDtoList"); return lentHistories.stream() .map(e -> lentMapper.toLentHistoryDto(e, e.getUser(), diff --git a/backend/src/main/java/org/ftclub/cabinet/cabinet/service/CabinetServiceImpl.java b/backend/src/main/java/org/ftclub/cabinet/cabinet/service/CabinetServiceImpl.java index 85a51f5ac..8292b0722 100644 --- a/backend/src/main/java/org/ftclub/cabinet/cabinet/service/CabinetServiceImpl.java +++ b/backend/src/main/java/org/ftclub/cabinet/cabinet/service/CabinetServiceImpl.java @@ -46,7 +46,7 @@ public Cabinet getLentCabinetByUserId(Long userId) { */ @Override public void updateStatus(Long cabinetId, CabinetStatus status) { - log.info("Called updateStatus: {}, {}", cabinetId, status); + log.debug("Called updateStatus: {}, {}", cabinetId, status); if (!status.isValid()) { throw new ServiceException(ExceptionStatus.INVALID_STATUS); } @@ -59,7 +59,7 @@ public void updateStatus(Long cabinetId, CabinetStatus status) { */ @Override public void updateMemo(Long cabinetId, String memo) { - log.info("Called updateMemo: {}, {}", cabinetId, memo); + log.debug("Called updateMemo: {}, {}", cabinetId, memo); Cabinet cabinet = cabinetOptionalFetcher.getCabinet(cabinetId); cabinet.writeMemo(memo); } @@ -69,7 +69,7 @@ public void updateMemo(Long cabinetId, String memo) { */ @Override public void updateVisibleNum(Long cabinetId, Integer visibleNum) { - log.info("Called updateVisibleNum: {}, {}", cabinetId, visibleNum); + log.debug("Called updateVisibleNum: {}, {}", cabinetId, visibleNum); if (visibleNum < 0) { throw new ServiceException(ExceptionStatus.INVALID_ARGUMENT); } @@ -82,14 +82,14 @@ public void updateVisibleNum(Long cabinetId, Integer visibleNum) { */ @Override public void updateTitle(Long cabinetId, String title) { - log.info("Called updateTitle: {}, {}", cabinetId, title); + log.debug("Called updateTitle: {}, {}", cabinetId, title); Cabinet cabinet = cabinetOptionalFetcher.getCabinet(cabinetId); cabinet.writeTitle(title); } @Override public void updateTitleAndMemo(Long cabinetId, String title, String memo) { - log.info("Called updateTitleAndMemo: {}, {}, {}", cabinetId, title, memo); + log.debug("Called updateTitleAndMemo: {}, {}, {}", cabinetId, title, memo); Cabinet cabinet = cabinetOptionalFetcher.getCabinet(cabinetId); if (StringUtils.hasText(title)) { cabinet.writeTitle(title); @@ -104,7 +104,7 @@ public void updateTitleAndMemo(Long cabinetId, String title, String memo) { */ @Override public void updateMaxUser(Long cabinetId, Integer maxUser) { - log.info("Called updateMaxUser: {}, {}", cabinetId, maxUser); + log.debug("Called updateMaxUser: {}, {}", cabinetId, maxUser); Cabinet cabinet = cabinetOptionalFetcher.getCabinet(cabinetId); cabinet.specifyMaxUser(maxUser); } @@ -114,7 +114,7 @@ public void updateMaxUser(Long cabinetId, Integer maxUser) { */ @Override public void updateLentType(Long cabinetId, LentType lentType) { - log.info("Called updateLentType: {}, {}", cabinetId, lentType); + log.debug("Called updateLentType: {}, {}", cabinetId, lentType); if (!lentType.isValid()) { throw new ServiceException(ExceptionStatus.INVALID_ARGUMENT); } @@ -132,7 +132,7 @@ public void updateLentType(Long cabinetId, LentType lentType) { */ @Override public void updateGrid(Long cabinetId, Grid grid) { - log.info("Called updateGrid: {}, {}", cabinetId, grid); + log.debug("Called updateGrid: {}, {}", cabinetId, grid); Cabinet cabinet = cabinetOptionalFetcher.getCabinet(cabinetId); cabinet.coordinateGrid(grid); } @@ -142,7 +142,7 @@ public void updateGrid(Long cabinetId, Grid grid) { */ @Override public void updateStatusNote(Long cabinetId, String statusNote) { - log.info("Called updateStatusNote: {}, {}", cabinetId, statusNote); + log.debug("Called updateStatusNote: {}, {}", cabinetId, statusNote); Cabinet cabinet = cabinetOptionalFetcher.getCabinet(cabinetId); cabinet.writeStatusNote(statusNote); } diff --git a/backend/src/main/java/org/ftclub/cabinet/config/InterceptorConfig.java b/backend/src/main/java/org/ftclub/cabinet/config/InterceptorConfig.java new file mode 100644 index 000000000..e30243e8a --- /dev/null +++ b/backend/src/main/java/org/ftclub/cabinet/config/InterceptorConfig.java @@ -0,0 +1,20 @@ +package org.ftclub.cabinet.config; + +import lombok.RequiredArgsConstructor; +import org.ftclub.cabinet.log.AllRequestLogInterceptor; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +@RequiredArgsConstructor +public class InterceptorConfig implements WebMvcConfigurer { + + private final AllRequestLogInterceptor allRequestLogInterceptor; + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(allRequestLogInterceptor) + .addPathPatterns("/**"); + } +} \ No newline at end of file diff --git a/backend/src/main/java/org/ftclub/cabinet/exception/ExceptionController.java b/backend/src/main/java/org/ftclub/cabinet/exception/ExceptionController.java index 8c8c3a953..8c63fbc94 100644 --- a/backend/src/main/java/org/ftclub/cabinet/exception/ExceptionController.java +++ b/backend/src/main/java/org/ftclub/cabinet/exception/ExceptionController.java @@ -11,7 +11,7 @@ public class ExceptionController { @ExceptionHandler(ControllerException.class) public ResponseEntity controllerExceptionHandler(ControllerException e) { - log.info("called ExceptionController for {}", e.status.getError()); + log.info("[ControllerException] {} : {}", e.status.getError(), e.status.getMessage()); return ResponseEntity .status(e.status.getStatusCode()) .body(e.status); @@ -19,7 +19,7 @@ public ResponseEntity controllerExceptionHandler(ControllerException e) { @ExceptionHandler(ServiceException.class) public ResponseEntity serviceExceptionHandler(ServiceException e) { - log.info("called ExceptionController for {}", e.status.getError()); + log.info("[ServiceException] {} : {}", e.status.getError(), e.status.getMessage()); return ResponseEntity .status(e.status.getStatusCode()) .body(e.status); @@ -27,7 +27,7 @@ public ResponseEntity serviceExceptionHandler(ServiceException e) { @ExceptionHandler(DomainException.class) public ResponseEntity domainExceptionHandler(DomainException e) { - log.info("called ExceptionController for {}", e.status.getError()); + log.warn("[DomainException] {} : {}", e.status.getError(), e.status.getMessage()); return ResponseEntity .status(e.status.getStatusCode()) .body(e.status); diff --git a/backend/src/main/java/org/ftclub/cabinet/lent/controller/AdminLentController.java b/backend/src/main/java/org/ftclub/cabinet/lent/controller/AdminLentController.java index 030b3f083..cfc88625d 100644 --- a/backend/src/main/java/org/ftclub/cabinet/lent/controller/AdminLentController.java +++ b/backend/src/main/java/org/ftclub/cabinet/lent/controller/AdminLentController.java @@ -27,14 +27,15 @@ public class AdminLentController { @AuthGuard(level = ADMIN_ONLY) public void terminateLentCabinets( @Valid @RequestBody ReturnCabinetsRequestDto returnCabinetsRequestDto) { - log.info("Called terminateLentCabinets"); + log.info("Called terminateLentCabinets returnCabinetsRequestDto={}", + returnCabinetsRequestDto); lentFacadeService.terminateLentCabinets(returnCabinetsRequestDto); } @PatchMapping("/return-users/{userId}") @AuthGuard(level = ADMIN_ONLY) public void terminateLentUser(@PathVariable("userId") Long userId) { - log.info("Called terminateLentUser"); + log.info("Called terminateLentUser userId={}", userId); lentFacadeService.terminateLentCabinet(userId); } @@ -42,7 +43,7 @@ public void terminateLentUser(@PathVariable("userId") Long userId) { @AuthGuard(level = ADMIN_ONLY) public void assignLent(@PathVariable("userId") Long userId, @PathVariable("cabinetId") Long cabinetId) { - log.info("Called assignLent"); + log.info("Called assignLent userId={} cabinetId={}", userId, cabinetId); lentFacadeService.assignLent(userId, cabinetId); } } diff --git a/backend/src/main/java/org/ftclub/cabinet/lent/controller/LentController.java b/backend/src/main/java/org/ftclub/cabinet/lent/controller/LentController.java index a405cf96b..1b935be36 100644 --- a/backend/src/main/java/org/ftclub/cabinet/lent/controller/LentController.java +++ b/backend/src/main/java/org/ftclub/cabinet/lent/controller/LentController.java @@ -35,14 +35,14 @@ public class LentController { public void startLentCabinet( @UserSession UserSessionDto user, @PathVariable Long cabinetId) { - log.info("Called startLentCabinet"); + log.info("Called startLentCabinet user: {}, cabinetId: {}", user, cabinetId); lentFacadeService.startLentCabinet(user.getUserId(), cabinetId); } @PatchMapping("/return") public void endLent( @UserSession UserSessionDto userSessionDto) { - log.info("Called endLent"); + log.info("Called endLent user: {}", userSessionDto); lentFacadeService.endLentCabinet(userSessionDto); } @@ -50,7 +50,7 @@ public void endLent( public void endLentWithMemo( @UserSession UserSessionDto userSessionDto, @Valid @RequestBody LentEndMemoDto lentEndMemoDto) { - log.info("Called endLentWithMemo"); + log.info("Called endLentWithMemo user: {}, lentEndMemoDto: {}", userSessionDto, lentEndMemoDto); lentFacadeService.endLentCabinetWithMemo(userSessionDto, lentEndMemoDto); } @@ -58,7 +58,7 @@ public void endLentWithMemo( public void updateCabinetMemo( @UserSession UserSessionDto user, @Valid @RequestBody UpdateCabinetMemoDto updateCabinetMemoDto) { - log.info("Called updateCabinetMemo"); + log.info("Called updateCabinetMemo user: {}, updateCabinetMemoDto: {}", user, updateCabinetMemoDto); lentFacadeService.updateCabinetMemo(user, updateCabinetMemoDto); } @@ -66,7 +66,7 @@ public void updateCabinetMemo( public void updateCabinetTitle( @UserSession UserSessionDto user, @Valid @RequestBody UpdateCabinetTitleDto updateCabinetTitleDto) { - log.info("Called updateCabinetTitle"); + log.info("Called updateCabinetTitle user: {}, updateCabinetTitleDto: {}", user, updateCabinetTitleDto); lentFacadeService.updateCabinetTitle(user, updateCabinetTitleDto); } @@ -74,14 +74,14 @@ public void updateCabinetTitle( public void updateCabinetInfo( @UserSession UserSessionDto user, @RequestBody CabinetInfoRequestDto cabinetInfoRequestDto) { - log.info("Called updateCabinetInfo"); + log.info("Called updateCabinetInfo user: {}, cabinetInfoRequestDto: {}", user, cabinetInfoRequestDto); lentFacadeService.updateCabinetInfo(user, cabinetInfoRequestDto); } @GetMapping("/me") public ResponseEntity getMyLentInfo( @UserSession UserSessionDto user) { - log.info("Called getMyLentInfo"); + log.info("Called getMyLentInfo user: {}", user); MyCabinetResponseDto myCabinetResponseDto = lentFacadeService.getMyLentInfo(user); if (myCabinetResponseDto == null) { return ResponseEntity.status(HttpStatus.NO_CONTENT).build(); @@ -94,7 +94,7 @@ public LentHistoryPaginationDto getMyLentLog( @UserSession UserSessionDto user, @RequestParam("page") Integer page, @RequestParam("size") Integer size) { - log.info("Called getMyLentLog"); + log.info("Called getMyLentLog user: {}, page: {}, size: {}", user, page, size); return lentFacadeService.getMyLentLog(user, page, size); } -} \ No newline at end of file +} diff --git a/backend/src/main/java/org/ftclub/cabinet/lent/domain/LentHistory.java b/backend/src/main/java/org/ftclub/cabinet/lent/domain/LentHistory.java index 64d407a41..3569f1213 100644 --- a/backend/src/main/java/org/ftclub/cabinet/lent/domain/LentHistory.java +++ b/backend/src/main/java/org/ftclub/cabinet/lent/domain/LentHistory.java @@ -4,6 +4,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.ToString; +import lombok.extern.log4j.Log4j2; import org.ftclub.cabinet.cabinet.domain.Cabinet; import org.ftclub.cabinet.exception.DomainException; import org.ftclub.cabinet.exception.ExceptionStatus; @@ -24,6 +25,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter @ToString(exclude = {"user", "cabinet"}) +@Log4j2 public class LentHistory { @Id @@ -149,6 +151,7 @@ public boolean isCabinetIdEqual(Long cabinetId) { * @param expiredAt 변경하고 싶은 만료일 */ public void setExpiredAt(LocalDateTime expiredAt) { + log.info("setExpiredAt : {}", expiredAt); this.expiredAt = expiredAt; ExceptionUtil.throwIfFalse(this.isValid(), new DomainException(ExceptionStatus.INVALID_STATUS)); @@ -216,10 +219,11 @@ public Long getDaysUntilExpiration(LocalDateTime now) { * @param now 설정하려고 하는 반납일 */ public void endLent(LocalDateTime now) { + log.info("setEndLent : {}", now); ExceptionUtil.throwIfFalse((this.isEndLentValid(now)), new DomainException(ExceptionStatus.INVALID_ARGUMENT)); this.endedAt = now; ExceptionUtil.throwIfFalse((this.isValid()), new DomainException(ExceptionStatus.INVALID_STATUS)); } -} \ No newline at end of file +} diff --git a/backend/src/main/java/org/ftclub/cabinet/lent/domain/LentPolicyImpl.java b/backend/src/main/java/org/ftclub/cabinet/lent/domain/LentPolicyImpl.java index 3a65b37ba..e23499394 100644 --- a/backend/src/main/java/org/ftclub/cabinet/lent/domain/LentPolicyImpl.java +++ b/backend/src/main/java/org/ftclub/cabinet/lent/domain/LentPolicyImpl.java @@ -28,7 +28,7 @@ public class LentPolicyImpl implements LentPolicy { private LocalDateTime generateSharedCabinetExpirationDate(LocalDateTime now, CabinetStatus cabinetStatus, LentHistory activeLentHistory) { - log.info("Called shareCabinetExpirationDateProcess"); + log.debug("Called shareCabinetExpirationDateProcess"); switch (cabinetStatus) { case AVAILABLE: @@ -51,7 +51,8 @@ private LocalDateTime generateSharedCabinetExpirationDate(LocalDateTime now, @Override public LocalDateTime generateExpirationDate(LocalDateTime now, Cabinet cabinet, List activeLentHistories) { - log.info("Called generateExpirationDate"); + log.info("Called generateExpirationDate now: {}, cabinet: {}, activeLentHistories: {}", + now, cabinet, activeLentHistories); if (!DateUtil.isSameDay(now)) { throw new IllegalArgumentException("현재 시각이 아닙니다."); @@ -74,7 +75,8 @@ public LocalDateTime generateExpirationDate(LocalDateTime now, Cabinet cabinet, @Override public void applyExpirationDate(LentHistory curHistory, List beforeActiveHistories, LocalDateTime expiredAt) { - log.info("Called applyExpirationDate"); + log.info("Called applyExpirationDate curHistory: {}, beforeActiveHistories: {}, expiredAt: {}", + curHistory, beforeActiveHistories, expiredAt); if (expiredAt == null){ throw new DomainException(ExceptionStatus.INVALID_ARGUMENT); @@ -93,7 +95,7 @@ public void applyExpirationDate(LentHistory curHistory, List before @Override public LentPolicyStatus verifyUserForLent(User user, Cabinet cabinet, int userActiveLentCount, List userActiveBanList) { - log.info("Called verifyUserForLent"); + log.debug("Called verifyUserForLent"); if (!user.isUserRole(UserRole.USER)) { return LentPolicyStatus.NOT_USER; } @@ -128,7 +130,8 @@ public LentPolicyStatus verifyUserForLent(User user, Cabinet cabinet, int userAc @Override public LentPolicyStatus verifyCabinetForLent(Cabinet cabinet, List cabinetLentHistories, LocalDateTime now) { - log.info("Called verifyCabinetForLent"); + log.info("Called verifyCabinetForLent cabinet: {}, cabinetLentHistories: {}, now: {}", + cabinet, cabinetLentHistories, now); // 빌릴 수 있는지 검증. 빌릴 수 없으면 return lentPolicyDto; switch (cabinet.getStatus()) { case FULL: @@ -157,19 +160,19 @@ public LentPolicyStatus verifyCabinetForLent(Cabinet cabinet, @Override public Integer getDaysForLentTermPrivate() { - log.info("Called getDaysForLentTermPrivate"); + log.debug("Called getDaysForLentTermPrivate"); return cabinetProperties.getLentTermPrivate(); } @Override public Integer getDaysForLentTermShare() { - log.info("Called getDaysForLentTermShare"); + log.debug("Called getDaysForLentTermShare"); return cabinetProperties.getLentTermShare(); } @Override public Integer getDaysForNearExpiration() { - log.info("Called getDaysForNearExpiration"); + log.debug("Called getDaysForNearExpiration"); return cabinetProperties.getPenaltyDayShare() + cabinetProperties.getPenaltyDayPadding(); } } diff --git a/backend/src/main/java/org/ftclub/cabinet/lent/repository/LentOptionalFetcher.java b/backend/src/main/java/org/ftclub/cabinet/lent/repository/LentOptionalFetcher.java index 72f3aed00..844b3eadc 100644 --- a/backend/src/main/java/org/ftclub/cabinet/lent/repository/LentOptionalFetcher.java +++ b/backend/src/main/java/org/ftclub/cabinet/lent/repository/LentOptionalFetcher.java @@ -29,17 +29,17 @@ public class LentOptionalFetcher { private final CabinetOptionalFetcher cabinetExceptionHandler; public List findAllActiveLentByCabinetId(Long cabinetId) { - log.info("Called findAllActiveLentByCabinetId: {}", cabinetId); + log.debug("Called findAllActiveLentByCabinetId: {}", cabinetId); return lentRepository.findAllActiveLentByCabinetId(cabinetId); } public Page findPaginationByCabinetId(Long cabinetId, PageRequest pageable) { - log.info("Called findPaginationByCabinetId: {}", cabinetId); + log.debug("Called findPaginationByCabinetId: {}", cabinetId); return lentRepository.findPaginationByCabinetId(cabinetId, pageable); } public Page findPaginationByUserId(Long userId, PageRequest pageable) { - log.info("Called findPaginationByUserId: {}", userId); + log.debug("Called findPaginationByUserId: {}", userId); return lentRepository.findPaginationByUserId(userId, pageable); } @@ -52,7 +52,7 @@ public Page findPaginationByUserId(Long userId, PageRequest pageabl * @throws ServiceException NO_LENT_CABINET */ public LentHistory getActiveLentHistoryWithUserIdAndCabinetId(Long userId, Long cabinetId) { - log.info("Called getActiveLentHistoryWithUserIdAndCabinetId: {}, {}", userId, cabinetId); + log.debug("Called getActiveLentHistoryWithUserIdAndCabinetId: {}, {}", userId, cabinetId); LentHistory ret = getActiveLentHistoryWithUserId(userId); if (!ret.isCabinetIdEqual(cabinetId)) { throw new ServiceException(ExceptionStatus.NO_LENT_CABINET); @@ -68,7 +68,7 @@ public LentHistory getActiveLentHistoryWithUserIdAndCabinetId(Long userId, Long * @throws ServiceException NO_LENT_CABINET */ public LentHistory getActiveLentHistoryWithCabinetId(Long cabinetId) { - log.info("Called getActiveLentHistoryWithCabinetId: {}", cabinetId); + log.debug("Called getActiveLentHistoryWithCabinetId: {}", cabinetId); return lentRepository.findFirstByCabinetIdAndEndedAtIsNull(cabinetId) .orElseThrow(() -> new ServiceException(ExceptionStatus.NO_LENT_CABINET)); } @@ -81,7 +81,7 @@ public LentHistory getActiveLentHistoryWithCabinetId(Long cabinetId) { * @throws ServiceException NO_LENT_CABINET */ public LentHistory getActiveLentHistoryWithUserId(Long userId) { - log.info("Called getActiveLentHistoryWithUserId: {}", userId); + log.debug("Called getActiveLentHistoryWithUserId: {}", userId); return lentRepository.findFirstByUserIdAndEndedAtIsNull(userId) .orElseThrow(() -> new ServiceException(ExceptionStatus.NO_LENT_CABINET)); } @@ -93,7 +93,7 @@ public LentHistory getActiveLentHistoryWithUserId(Long userId) { * @throws ServiceException 정책에 따라 다양한 exception이 throw될 수 있습니다. */ public void handlePolicyStatus(LentPolicyStatus status) { - log.info("Called handlePolicyStatus: {}", status); + log.info("Called handlePolicyStatus status: {}", status); switch (status) { case FINE: break; @@ -129,7 +129,7 @@ public void handlePolicyStatus(LentPolicyStatus status) { * @throws ServiceException LENT_FULL, NOT_FOUND_CABINET */ public void checkExistedSpace(Long cabinetId) { - log.info("Called checkExistedSpace: {}", cabinetId); + log.debug("Called checkExistedSpace: {}", cabinetId); Cabinet cabinet = cabinetExceptionHandler.getCabinet(cabinetId); if (lentRepository.countCabinetActiveLent(cabinetId) == cabinet.getMaxUser()) { throw new ServiceException(ExceptionStatus.LENT_FULL); @@ -144,7 +144,7 @@ public void checkExistedSpace(Long cabinetId) { * @return */ public List findByUserId(Long userId, Pageable pageable) { - log.info("Called findByUserId: {}", userId); + log.debug("Called findByUserId: {}", userId); return lentRepository.findByUserId(userId, pageable); } @@ -157,7 +157,7 @@ public List findByUserId(Long userId, Pageable pageable) { */ public List findByUserIdAndEndedAtNotNull(Long userId, Pageable pageable) { - log.info("Called findByUserId: {}", userId); + log.debug("Called findByUserId: {}", userId); return lentRepository.findByUserIdAndEndedAtNotNull(userId, pageable); } @@ -168,7 +168,7 @@ public List findByUserIdAndEndedAtNotNull(Long userId, Pageable pag */ public int countUserAllLent(Long userId) { - log.info("Called countUserAllLent: {}", userId); + log.debug("Called countUserAllLent: {}", userId); return lentRepository.countUserAllLent(userId); } @@ -178,7 +178,7 @@ public int countUserAllLent(Long userId) { * @return 캐비넷이 대여된 기록 */ public List findByCabinetId(Long cabinetId, Pageable pageable) { - log.info("Called findByCabinetId: {}", cabinetId); + log.debug("Called findByCabinetId: {}", cabinetId); return lentRepository.findByCabinetId(cabinetId, pageable); } @@ -187,12 +187,12 @@ public List findByCabinetId(Long cabinetId, Pageable pageable) { * @return 캐비넷이 대여된 총 횟수 */ public int countCabinetAllLent(Long cabinetId) { - log.info("Called countCabinetAllLent: {}", cabinetId); + log.debug("Called countCabinetAllLent: {}", cabinetId); return lentRepository.countCabinetAllLent(cabinetId); } public List findAllActiveLentHistories() { - log.info("Called findAllActiveLentHistories"); + log.debug("Called findAllActiveLentHistories"); return lentRepository.findAllActiveLentHistories(); } @@ -201,17 +201,17 @@ public List findAllActiveLentHistories() { * @return 유저가 대여중인 캐비넷 */ public Cabinet findActiveLentCabinetByUserId(Long userId) { - log.info("Called findActiveLentCabinetByUserId: {}", userId); + log.debug("Called findActiveLentCabinetByUserId: {}", userId); return cabinetRepository.findLentCabinetByUserId(userId).orElse(null); } public List findAllOverdueLent(LocalDateTime date, Pageable pageable) { - log.info("Called findAllOverdueLent: {}", date); + log.debug("Called findAllOverdueLent: {}", date); return lentRepository.findAllOverdueLent(date, pageable); } public Integer countCabinetAllActiveLent(Long cabinetId) { - log.info("Called countCabinetAllActiveLent: {}", cabinetId); + log.debug("Called countCabinetAllActiveLent: {}", cabinetId); return lentRepository.countCabinetAllActiveLent(cabinetId); } } diff --git a/backend/src/main/java/org/ftclub/cabinet/lent/service/LentFacadeServiceImpl.java b/backend/src/main/java/org/ftclub/cabinet/lent/service/LentFacadeServiceImpl.java index 2ee43bcba..c86d559c2 100644 --- a/backend/src/main/java/org/ftclub/cabinet/lent/service/LentFacadeServiceImpl.java +++ b/backend/src/main/java/org/ftclub/cabinet/lent/service/LentFacadeServiceImpl.java @@ -49,7 +49,7 @@ public class LentFacadeServiceImpl implements LentFacadeService { @Override public LentHistoryPaginationDto getAllUserLentHistories(Long userId, Integer page, Integer size) { - log.info("Called getAllUserLentHistories: {}", userId); + log.debug("Called getAllUserLentHistories: {}", userId); userOptionalFetcher.findUser(userId); //todo: 예쁘게 수정 if (size <= 0) { @@ -63,7 +63,7 @@ public LentHistoryPaginationDto getAllUserLentHistories(Long userId, Integer pag @Override public LentHistoryPaginationDto getAllCabinetLentHistories(Long cabinetId, Integer page, Integer size) { - log.info("Called getAllCabinetLentHistories: {}", cabinetId); + log.debug("Called getAllCabinetLentHistories: {}", cabinetId); cabinetOptionalFetcher.getCabinet(cabinetId); PageRequest pageable = PageRequest.of(page, size, Sort.by("startedAt")); Page lentHistories = lentOptionalFetcher.findPaginationByCabinetId(cabinetId, pageable); @@ -72,7 +72,7 @@ public LentHistoryPaginationDto getAllCabinetLentHistories(Long cabinetId, Integ @Override public List getLentDtoList(Long cabinetId) { - log.info("Called getLentDtoList: {}", cabinetId); + log.debug("Called getLentDtoList: {}", cabinetId); cabinetOptionalFetcher.getCabinet(cabinetId); List lentHistories = lentOptionalFetcher.findAllActiveLentByCabinetId( cabinetId); @@ -99,7 +99,7 @@ public List getLentDtoList(Long cabinetId) { @Override public LentHistoryPaginationDto getMyLentLog(UserSessionDto user, Integer page, Integer size) { - log.info("Called getMyLentLog: {}", user.getName()); + log.debug("Called getMyLentLog: {}", user.getName()); PageRequest pageable = PageRequest.of(page, size, Sort.by(Sort.Direction.DESC, "startedAt")); List myLentHistories = lentOptionalFetcher.findByUserIdAndEndedAtNotNull( @@ -126,7 +126,7 @@ private LentHistoryPaginationDto generateLentHistoryPaginationDto( @Override public MyCabinetResponseDto getMyLentInfo(@UserSession UserSessionDto user) { - log.info("Called getMyLentInfo: {}", user.getName()); + log.debug("Called getMyLentInfo: {}", user.getName()); Cabinet myCabinet = lentOptionalFetcher.findActiveLentCabinetByUserId(user.getUserId()); if (myCabinet == null) { return null; @@ -154,7 +154,7 @@ public void endLentCabinet(UserSessionDto user) { @Override public void endLentCabinetWithMemo(UserSessionDto user, LentEndMemoDto lentEndMemoDto) { - log.info("Called endLentCabinetWithMemo: {}", user.getName()); + log.debug("Called endLentCabinetWithMemo: {}", user.getName()); Cabinet cabinet = cabinetService.getLentCabinetByUserId(user.getUserId()); lentService.endLentCabinet(user.getUserId()); cabinetService.updateMemo(cabinet.getCabinetId(), lentEndMemoDto.getCabinetMemo()); @@ -167,14 +167,14 @@ public void terminateLentCabinet(Long userId) { @Override public void terminateLentCabinets(ReturnCabinetsRequestDto returnCabinetsRequestDto) { - log.info("Called terminateLentCabinets"); + log.debug("Called terminateLentCabinets"); returnCabinetsRequestDto.getCabinetIds().stream() .forEach(lentService::terminateLentByCabinetId); } @Override public void updateCabinetMemo(UserSessionDto user, UpdateCabinetMemoDto updateCabinetMemoDto) { - log.info("Called updateCabinetMemo: {}", user.getName()); + log.debug("Called updateCabinetMemo: {}", user.getName()); Cabinet myCabinet = cabinetService.getLentCabinetByUserId((user.getUserId())); cabinetService.updateMemo(myCabinet.getCabinetId(), updateCabinetMemoDto.getMemo()); } @@ -182,7 +182,7 @@ public void updateCabinetMemo(UserSessionDto user, UpdateCabinetMemoDto updateCa @Override public void updateCabinetTitle(UserSessionDto user, UpdateCabinetTitleDto updateCabinetTitleDto) { - log.info("Called updateCabinetTitle: {}", user.getName()); + log.debug("Called updateCabinetTitle: {}", user.getName()); Cabinet myCabinet = cabinetService.getLentCabinetByUserId(user.getUserId()); cabinetService.updateTitle(myCabinet.getCabinetId(), updateCabinetTitleDto.getCabinetTitle()); @@ -191,7 +191,7 @@ public void updateCabinetTitle(UserSessionDto user, @Override public void updateCabinetInfo(UserSessionDto user, CabinetInfoRequestDto cabinetInfoRequestDto) { - log.info("Called updateCabinetInfo: {}", user.getName()); + log.debug("Called updateCabinetInfo: {}", user.getName()); Cabinet myCabinet = cabinetService.getLentCabinetByUserId(user.getUserId()); diff --git a/backend/src/main/java/org/ftclub/cabinet/lent/service/LentServiceImpl.java b/backend/src/main/java/org/ftclub/cabinet/lent/service/LentServiceImpl.java index 0db856265..8094d2505 100644 --- a/backend/src/main/java/org/ftclub/cabinet/lent/service/LentServiceImpl.java +++ b/backend/src/main/java/org/ftclub/cabinet/lent/service/LentServiceImpl.java @@ -66,7 +66,7 @@ public void startLentCabinet(Long userId, Long cabinetId) { @Override public void startLentClubCabinet(Long userId, Long cabinetId) { - log.info("Called startLentClubCabinet: {}, {}", userId, cabinetId); + log.debug("Called startLentClubCabinet: {}, {}", userId, cabinetId); Cabinet cabinet = cabinetOptionalFetcher.getClubCabinet(cabinetId); lentOptionalFetcher.checkExistedSpace(cabinetId); LocalDateTime expirationDate = lentPolicy.generateExpirationDate(LocalDateTime.now(), @@ -79,7 +79,7 @@ public void startLentClubCabinet(Long userId, Long cabinetId) { @Override public void endLentCabinet(Long userId) { - log.info("Called endLentCabinet: {}", userId); + log.debug("Called endLentCabinet: {}", userId); LentHistory lentHistory = returnCabinetByUserId(userId); Cabinet cabinet = cabinetOptionalFetcher.getCabinetForUpdate(lentHistory.getCabinetId()); // cabinetType도 인자로 전달하면 좋을 거 같습니다 (공유사물함 3일이내 반납 페널티) @@ -89,13 +89,13 @@ public void endLentCabinet(Long userId) { @Override public void terminateLentCabinet(Long userId) { - log.info("Called terminateLentCabinet: {}", userId); + log.debug("Called terminateLentCabinet: {}", userId); returnCabinetByUserId(userId); } @Override public void terminateLentByCabinetId(Long cabinetId) { - log.info("Called terminateLentByCabinetId: {}", cabinetId); + log.debug("Called terminateLentByCabinetId: {}", cabinetId); returnCabinetByCabinetId(cabinetId); } @@ -105,7 +105,7 @@ public void terminateLentByCabinetId(Long cabinetId) { // 유저가 사용하는 경우에 대해서는 userId로만 쓰게하든, 한 방식으로만 사용하게끔 해야함 - 함수를 쪼갤 가능성도 있음. // 우선 현재 관리자만 쓰고 있고, 한 군데에서만 사용되므로 List로 전체 반납을 하도록 구현, 이에 대한 논의는 TO-DO private List returnCabinetByCabinetId(Long cabinetId) { - log.info("Called returnCabinetByCabinetId: {}", cabinetId); + log.debug("Called returnCabinetByCabinetId: {}", cabinetId); Cabinet cabinet = cabinetOptionalFetcher.getCabinetForUpdate(cabinetId); List lentHistories = lentOptionalFetcher.findAllActiveLentByCabinetId( cabinetId); @@ -117,7 +117,7 @@ private List returnCabinetByCabinetId(Long cabinetId) { } private LentHistory returnCabinetByUserId(Long userId) { - log.info("Called returnCabinet: {}", userId); + log.debug("Called returnCabinet: {}", userId); userExceptionHandler.getUser(userId); LentHistory lentHistory = lentOptionalFetcher.getActiveLentHistoryWithUserId(userId); Cabinet cabinet = cabinetOptionalFetcher.getCabinetForUpdate(lentHistory.getCabinetId()); @@ -133,7 +133,7 @@ private LentHistory returnCabinetByUserId(Long userId) { @Override public void assignLent(Long userId, Long cabinetId) { - log.info("Called assignLent: {}, {}", userId, cabinetId); + log.debug("Called assignLent: {}, {}", userId, cabinetId); userExceptionHandler.getUser(userId); Cabinet cabinet = cabinetOptionalFetcher.getCabinetForUpdate(cabinetId); lentOptionalFetcher.checkExistedSpace(cabinetId); @@ -146,7 +146,7 @@ public void assignLent(Long userId, Long cabinetId) { @Override public List getAllActiveLentHistories() { - log.info("Called getAllActiveLentHistories"); + log.debug("Called getAllActiveLentHistories"); List lentHistories = lentOptionalFetcher.findAllActiveLentHistories(); LocalDateTime now = LocalDateTime.now(); return lentHistories.stream() @@ -158,4 +158,4 @@ public List getAllActiveLentHistories() { )) .collect(Collectors.toList()); } -} \ No newline at end of file +} diff --git a/backend/src/main/java/org/ftclub/cabinet/log/AllRequestLogInterceptor.java b/backend/src/main/java/org/ftclub/cabinet/log/AllRequestLogInterceptor.java new file mode 100644 index 000000000..d09bb9d0e --- /dev/null +++ b/backend/src/main/java/org/ftclub/cabinet/log/AllRequestLogInterceptor.java @@ -0,0 +1,82 @@ +package org.ftclub.cabinet.log; + + +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.UUID; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import lombok.RequiredArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.ftclub.cabinet.auth.domain.CookieManager; +import org.ftclub.cabinet.auth.domain.TokenValidator; +import org.ftclub.cabinet.config.JwtProperties; +import org.slf4j.MDC; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.servlet.ModelAndView; + +@Component +@RequiredArgsConstructor +@Log4j2 +public class AllRequestLogInterceptor implements HandlerInterceptor { + + private final static String USER_ID = "userId"; + private static final List IP_HEADERS = Arrays.asList("X-Forwarded-For", + "Proxy-Client-IP", "WL-Proxy-Client-IP", "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR"); + private final TokenValidator tokenValidator; + private final CookieManager cookieManager; + private final JwtProperties jwtProperties; + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, + Object handler) { + MDC.put(USER_ID, getUserId(request)); + return true; + } + + + @Override + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, + ModelAndView modelAndView) { + String ip = getClientIpAddr(request); + String action = request.getRequestURI(); + int status = response.getStatus(); + log.debug("IP: {}, action: {}, status: {}", ip, action, status); + } + + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, + Object handler, Exception ex) throws Exception { + MDC.remove(USER_ID); + MDC.clear(); + } + + private String getClientIpAddr(HttpServletRequest request) { + return IP_HEADERS.stream() + .map(request::getHeader) + .filter(Objects::nonNull) + .filter(ip -> !ip.isEmpty() && !ip.equalsIgnoreCase("unknown")) + .findFirst() + .orElseGet(request::getRemoteAddr); + } + + private String getUserId(HttpServletRequest request) { + String ret = null; + try { + ret = tokenValidator.getPayloadJson( + cookieManager.getCookieValue(request, jwtProperties.getMainTokenName())) + .get("name") + .asText(); + } catch (Exception ignore) { + } + + if (ret != null) { + return ret; + } else { + String uuid = UUID.randomUUID().toString(); + return uuid.substring(uuid.length() - 12); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/org/ftclub/cabinet/search/controller/SearchController.java b/backend/src/main/java/org/ftclub/cabinet/search/controller/SearchController.java index 9bb8c9676..0e25e5c7b 100644 --- a/backend/src/main/java/org/ftclub/cabinet/search/controller/SearchController.java +++ b/backend/src/main/java/org/ftclub/cabinet/search/controller/SearchController.java @@ -30,7 +30,7 @@ public class SearchController { public CabinetInfoPaginationDto getCabinetsInfo( @RequestParam("visibleNum") Integer visibleNum ) { - log.info("Called getCabinetsInfo"); + log.info("Called getCabinetsInfo {}", visibleNum); return cabinetFacadeService.getCabinetsInfo(visibleNum); } @@ -39,7 +39,7 @@ public CabinetInfoPaginationDto getCabinetsInfo( public CabinetSimplePaginationDto getCabinetsSimpleInfo( @RequestParam("visibleNum") Integer visibleNum ) { - log.info("Called getCabinetsInfo"); + log.info("Called getCabinetsInfo {}", visibleNum); return cabinetFacadeService.getCabinetsSimpleInfoByVisibleNum(visibleNum); } @@ -50,7 +50,7 @@ public UserProfilePaginationDto getUsersProfile( @RequestParam("page") Integer page, @RequestParam("size") Integer size ) { - log.info("Called getUsersProfile"); + log.info("Called getUsersProfile {}", name); return userFacadeService.getUserProfileListByPartialName(name, page, size); } @@ -61,7 +61,7 @@ public UserCabinetPaginationDto getCabinetsLentInfo( @RequestParam("page") Integer page, @RequestParam("size") Integer size ) { - log.info("Called getCabinetsLentInfo"); + log.info("Called getCabinetsLentInfo {}", name); return userFacadeService.findUserCabinetListByPartialName(name, page, size); } diff --git a/backend/src/main/java/org/ftclub/cabinet/statistics/controller/StatisticsController.java b/backend/src/main/java/org/ftclub/cabinet/statistics/controller/StatisticsController.java index 5c252b39e..2c54b0313 100644 --- a/backend/src/main/java/org/ftclub/cabinet/statistics/controller/StatisticsController.java +++ b/backend/src/main/java/org/ftclub/cabinet/statistics/controller/StatisticsController.java @@ -54,7 +54,7 @@ public LentsStatisticsResponseDto getCountOnLentAndReturn( @RequestParam("startDate") @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime startDate, @RequestParam("endDate") @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime endDate ) { - log.info("Called getCountOnLentAndReturn"); + log.info("Called getCountOnLentAndReturn startDate : {} endDate : {}", startDate, endDate); return statisticsFacadeService.getCountOnLentAndReturn(startDate, endDate); } diff --git a/backend/src/main/java/org/ftclub/cabinet/statistics/service/StatisticsFacadeServiceImpl.java b/backend/src/main/java/org/ftclub/cabinet/statistics/service/StatisticsFacadeServiceImpl.java index 41eba957d..114cddd1f 100644 --- a/backend/src/main/java/org/ftclub/cabinet/statistics/service/StatisticsFacadeServiceImpl.java +++ b/backend/src/main/java/org/ftclub/cabinet/statistics/service/StatisticsFacadeServiceImpl.java @@ -33,7 +33,7 @@ public class StatisticsFacadeServiceImpl implements StatisticsFacadeService { */ @Override public List getCabinetsCountOnAllFloors() { - log.info("Called getCabinetsCountOnAllFloors"); + log.debug("Called getCabinetsCountOnAllFloors"); List cabinetFloorStatisticsResponseDtos = new ArrayList<>(); List floors = cabinetOptionalFetcher.findAllFloorsByBuilding("새롬관"); throwIfFalse(floors != null, new ServiceException(ExceptionStatus.INVALID_ARGUMENT)); @@ -68,7 +68,7 @@ public List getCabinetsCountOnAllFloors() { @Override public LentsStatisticsResponseDto getCountOnLentAndReturn(LocalDateTime startDate, LocalDateTime endDate) { - log.info("Called getCountOnLentAndReturn"); + log.debug("Called getCountOnLentAndReturn"); throwIfFalse(startDate.isBefore(endDate), new ServiceException(ExceptionStatus.INVALID_ARGUMENT)); Integer lentStartCount = lentRepository.countLentByTimeDuration(startDate, endDate); diff --git a/backend/src/main/java/org/ftclub/cabinet/user/domain/AdminUser.java b/backend/src/main/java/org/ftclub/cabinet/user/domain/AdminUser.java index 33cb040cd..090a457f5 100644 --- a/backend/src/main/java/org/ftclub/cabinet/user/domain/AdminUser.java +++ b/backend/src/main/java/org/ftclub/cabinet/user/domain/AdminUser.java @@ -21,6 +21,7 @@ import org.ftclub.cabinet.exception.DomainException; import org.ftclub.cabinet.exception.ExceptionStatus; import org.ftclub.cabinet.utils.ExceptionUtil; +import lombok.extern.log4j.Log4j2; /** * 관리자 엔티티 클래스입니다. @@ -29,6 +30,7 @@ @Table(name = "ADMIN_USER") @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter +@Log4j2 public class AdminUser { @Id @@ -83,8 +85,9 @@ public boolean equals(final Object other) { } public void changeAdminRole(AdminRole role) { + log.info("Called changedAdminRole - role from {} to {}", this.role, role); this.role = role; ExceptionUtil.throwIfFalse(this.isValid(), new DomainException(ExceptionStatus.INVALID_ARGUMENT)); } -} \ No newline at end of file +} diff --git a/backend/src/main/java/org/ftclub/cabinet/user/domain/BanPolicyImpl.java b/backend/src/main/java/org/ftclub/cabinet/user/domain/BanPolicyImpl.java index 7bd76d96a..6a41d76cf 100644 --- a/backend/src/main/java/org/ftclub/cabinet/user/domain/BanPolicyImpl.java +++ b/backend/src/main/java/org/ftclub/cabinet/user/domain/BanPolicyImpl.java @@ -21,7 +21,7 @@ public class BanPolicyImpl implements BanPolicy { @Override public BanType verifyForBanType(LentType lentType, LocalDateTime startAt, LocalDateTime endedAt, LocalDateTime expiredAt) { - log.info("Called verifyForBanType"); + log.debug("Called verifyForBanType"); if (checkAlreadyExpired(endedAt, expiredAt)) { return BanType.ALL; } @@ -36,7 +36,7 @@ public BanType verifyForBanType(LentType lentType, LocalDateTime startAt, LocalD @Override public LocalDateTime getBanDate(BanType banType, LocalDateTime endedAt, LocalDateTime expiredAt, Long userId) { - log.info("Called getBanDate"); + log.debug("Called getBanDate"); if (banType == BanType.SHARE) { return endedAt.plusDays(cabinetProperties.getPenaltyDayShare()); } else { @@ -48,19 +48,19 @@ public LocalDateTime getBanDate(BanType banType, LocalDateTime endedAt, LocalDat @Override public boolean checkAlreadyExpired(LocalDateTime endedAt, LocalDateTime expiredAt) { - log.info("Called checkAlreadyExpired"); + log.debug("Called checkAlreadyExpired"); return expiredAt.isBefore(endedAt); } @Override public boolean isActiveBanHistory(LocalDateTime unbannedAt, LocalDateTime now) { - log.info("Called isActiveBanHistory"); + log.debug("Called isActiveBanHistory"); return now.isBefore(unbannedAt); } @Override public Long getAccumulateBanDaysByUserId(Long userId) { - log.info("Called getAccumulateBanDaysByUserId"); + log.debug("Called getAccumulateBanDaysByUserId"); List banHistories = banHistoryRepository.findBanHistoriesByUserId(userId); Long accumulateDays = 0L; for (BanHistory history : banHistories) { diff --git a/backend/src/main/java/org/ftclub/cabinet/user/domain/User.java b/backend/src/main/java/org/ftclub/cabinet/user/domain/User.java index bb46d7b01..fbb277336 100644 --- a/backend/src/main/java/org/ftclub/cabinet/user/domain/User.java +++ b/backend/src/main/java/org/ftclub/cabinet/user/domain/User.java @@ -14,12 +14,14 @@ import java.time.LocalDateTime; import java.util.Objects; import java.util.regex.Pattern; +import lombok.extern.log4j.Log4j2; @Entity @Table(name = "USER") @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter @ToString +@Log4j2 public class User { @Id @@ -83,16 +85,19 @@ public boolean isUserRole(UserRole role) { } public void changeBlackholedAt(LocalDateTime blackholedAt) { + log.info("Called changeBlackholedAt - form {} to {}", this.blackholedAt, blackholedAt); this.blackholedAt = blackholedAt; } public void setDeletedAt(LocalDateTime deletedAt) { + log.info("Called setDeletedAt - from {} to {}", this.deletedAt, deletedAt); this.deletedAt = deletedAt; } public void changeName(String name) { + log.info("Called changeName - from {} to {}", this.name, name); this.name = name; ExceptionUtil.throwIfFalse(this.isValid(), new DomainException(ExceptionStatus.INVALID_ARGUMENT)); } -} \ No newline at end of file +} diff --git a/backend/src/main/java/org/ftclub/cabinet/user/repository/UserOptionalFetcher.java b/backend/src/main/java/org/ftclub/cabinet/user/repository/UserOptionalFetcher.java index 04a3e883c..0386d7e44 100644 --- a/backend/src/main/java/org/ftclub/cabinet/user/repository/UserOptionalFetcher.java +++ b/backend/src/main/java/org/ftclub/cabinet/user/repository/UserOptionalFetcher.java @@ -34,7 +34,7 @@ public class UserOptionalFetcher { * @return {@link List} of {@link User} */ public List findAllUsers() { - log.info("Called findAllUsers"); + log.debug("Called findAllUsers"); return userRepository.findAll(); } @@ -45,7 +45,7 @@ public List findAllUsers() { * @return {@link User} */ public User findUser(Long userId) { - log.info("Called findUser: {}", userId); + log.debug("Called findUser: {}", userId); return userRepository.findUser(userId).orElse(null); } @@ -56,7 +56,7 @@ public User findUser(Long userId) { * @return 찾은 유저의 고유 id */ public User findUserByName(String name) { - log.info("Called findUserByName: {}", name); + log.debug("Called findUserByName: {}", name); return userRepository.findByName(name).orElse(null); } @@ -66,7 +66,7 @@ public User findUserByName(String name) { * @param email 유저의 이메일 */ public User findUserByEmail(String email) { - log.info("Called findUserByEmail: {}", email); + log.debug("Called findUserByEmail: {}", email); return userRepository.findByEmail(email).orElse(null); } @@ -78,7 +78,7 @@ public User findUserByEmail(String email) { * @return {@link Page} of {@link User} */ public Page findUsersByPartialName(String name, Pageable pageable) { - log.info("Called findUsersByPartialName: {}", name); + log.debug("Called findUsersByPartialName: {}", name); return userRepository.findByPartialName(name, pageable); } @@ -89,7 +89,7 @@ public Page findUsersByPartialName(String name, Pageable pageable) { * @return {@link AdminUser} */ public AdminUser findAdminUser(Long adminUserId) { - log.info("Called findAdminUser: {}", adminUserId); + log.debug("Called findAdminUser: {}", adminUserId); return adminUserRepository.findAdminUser(adminUserId).orElse(null); } @@ -100,7 +100,7 @@ public AdminUser findAdminUser(Long adminUserId) { * @return {@link AdminUser} */ public AdminUser findAdminUserByEmail(String email) { - log.info("Called findAdminUserByEmail: {}", email); + log.debug("Called findAdminUserByEmail: {}", email); return adminUserRepository.findAdminUserByEmail(email).orElse(null); } @@ -108,7 +108,7 @@ public AdminUser findAdminUserByEmail(String email) { * */ public AdminRole findAdminUserRoleByEmail(String email) { - log.info("Called findAdminUserRoleByEmail: {}", email); + log.debug("Called findAdminUserRoleByEmail: {}", email); return adminUserRepository.findAdminUserRoleByEmail(email) .orElse(null); } @@ -121,7 +121,7 @@ public AdminRole findAdminUserRoleByEmail(String email) { * @return {@link Page} of {@link BanHistory} */ public Page findPaginationActiveBanHistories(Pageable pageable, LocalDateTime now) { - log.info("Called findPaginationActiveBanHistories"); + log.debug("Called findPaginationActiveBanHistories"); return banHistoryRepository.findPaginationActiveBanHistories(pageable, now); } @@ -134,7 +134,7 @@ public Page findPaginationActiveBanHistories(Pageable pageable, Loca */ //TO-DO : isEmpty, List에 대한 0 인덱스 가져오기 등 리팩터링 매우 필요.. public BanHistory findRecentActiveBanHistory(Long userId, LocalDateTime now) { - log.info("Called findRecentActiveBanHistory: {}", userId); + log.debug("Called findRecentActiveBanHistory: {}", userId); List banHistories = banHistoryRepository.findRecentBanHistoryByUserId(userId, now, PageRequest.of(0, 1)); @@ -151,7 +151,7 @@ public BanHistory findRecentActiveBanHistory(Long userId, LocalDateTime now) { * @return {@link Page} */ public Page findClubUsers(Pageable pageable) { - log.info("Called findClubUsers"); + log.debug("Called findClubUsers"); return userRepository.findAllByRoleAndDeletedAtIsNull(UserRole.CLUB, pageable); } @@ -164,7 +164,7 @@ public Page findClubUsers(Pageable pageable) { * @return {@link User} */ public User getUser(Long userId) { - log.info("Called getUser: {}", userId); + log.debug("Called getUser: {}", userId); return userRepository.findUser(userId) .orElseThrow(() -> new ServiceException(ExceptionStatus.NOT_FOUND_USER)); } @@ -177,7 +177,7 @@ public User getUser(Long userId) { * @return 찾은 유저의 고유 id */ public User getUserByName(String name) { - log.info("Called getUserByName: {}", name); + log.debug("Called getUserByName: {}", name); return userRepository.findByName(name) .orElseThrow(() -> new ServiceException(ExceptionStatus.NOT_FOUND_USER)); } @@ -189,7 +189,7 @@ public User getUserByName(String name) { * @return {@link User} */ public User getClubUser(Long userId) { - log.info("Called getClubUser: {}", userId); + log.debug("Called getClubUser: {}", userId); User user = getUser(userId); if (!user.isUserRole(UserRole.CLUB)) { throw new ServiceException(ExceptionStatus.NOT_FOUND_USER); @@ -204,7 +204,7 @@ public User getClubUser(Long userId) { * @return {@link AdminUser} */ public AdminUser getAdminUser(Long adminUserId) { - log.info("Called getAdminUser: {}", adminUserId); + log.debug("Called getAdminUser: {}", adminUserId); return adminUserRepository.findAdminUser(adminUserId) .orElseThrow(() -> new ServiceException(ExceptionStatus.NOT_FOUND_ADMIN_USER)); } @@ -216,7 +216,7 @@ public AdminUser getAdminUser(Long adminUserId) { * @return {@link User} */ public AdminUser getAdminUserByEmail(String adminUserEmail) { - log.info("Called getAdminUserByEmail: {}", adminUserEmail); + log.debug("Called getAdminUserByEmail: {}", adminUserEmail); return adminUserRepository.findAdminUserByEmail(adminUserEmail) .orElseThrow(() -> new ServiceException(ExceptionStatus.NOT_FOUND_ADMIN_USER)); } @@ -229,7 +229,7 @@ public AdminUser getAdminUserByEmail(String adminUserEmail) { */ //to-do : if null exception public BanHistory getRecentBanHistory(Long userId) { - log.info("Called getRecentBanHistory: {}", userId); + log.debug("Called getRecentBanHistory: {}", userId); List banHistory = banHistoryRepository.findRecentBanHistoryByUserId(userId, LocalDateTime.now(), PageRequest.of(0, 1)); diff --git a/backend/src/main/java/org/ftclub/cabinet/user/service/UserFacadeServiceImpl.java b/backend/src/main/java/org/ftclub/cabinet/user/service/UserFacadeServiceImpl.java index 6d1744ef1..8afc9a383 100644 --- a/backend/src/main/java/org/ftclub/cabinet/user/service/UserFacadeServiceImpl.java +++ b/backend/src/main/java/org/ftclub/cabinet/user/service/UserFacadeServiceImpl.java @@ -48,7 +48,7 @@ public class UserFacadeServiceImpl implements UserFacadeService { @Override public MyProfileResponseDto getMyProfile(UserSessionDto user) { - log.info("Called getMyProfile: {}", user.getName()); + log.debug("Called getMyProfile: {}", user.getName()); Cabinet cabinet = lentOptionalFetcher.findActiveLentCabinetByUserId(user.getUserId()); BanHistory banHistory = userOptionalFetcher.findRecentActiveBanHistory(user.getUserId(), LocalDateTime.now()); @@ -57,7 +57,7 @@ public MyProfileResponseDto getMyProfile(UserSessionDto user) { @Override public BlockedUserPaginationDto getAllBanUsers(Integer page, Integer size, LocalDateTime now) { - log.info("Called getAllBanUsers"); + log.debug("Called getAllBanUsers"); if (size <= 0) { size = Integer.MAX_VALUE; } @@ -75,7 +75,7 @@ public BlockedUserPaginationDto getAllBanUsers(Integer page, Integer size, Local @Override public UserProfilePaginationDto getUserProfileListByPartialName(String name, Integer page, Integer size) { - log.info("Called getUserProfileListByPartialName: {}", name); + log.debug("Called getUserProfileListByPartialName: {}", name); // todo - size가 0일 때 모든 데이터를 가져오기 if (size <= 0) { size = Integer.MAX_VALUE; @@ -92,7 +92,7 @@ public UserProfilePaginationDto getUserProfileListByPartialName(String name, Int @Override public UserCabinetPaginationDto findUserCabinetListByPartialName(String name, Integer page, Integer size) { - log.info("Called findUserCabinetListByPartialName: {}", name); + log.debug("Called findUserCabinetListByPartialName: {}", name); // todo - size가 0일 때 모든 데이터를 가져오기 if (size <= 0) { size = Integer.MAX_VALUE; @@ -195,7 +195,7 @@ public void deleteRecentBanHistory(Long userId, LocalDateTime today) { @Override public OverdueUserCabinetPaginationDto getOverdueUserList(Integer page, Integer size) { - log.info("Called getOverdueUserList"); + log.debug("Called getOverdueUserList"); List overdueList = new ArrayList<>(); // todo - size가 0일 때 모든 데이터를 가져오기 if (size <= 0) { @@ -219,7 +219,7 @@ public OverdueUserCabinetPaginationDto getOverdueUserList(Integer page, Integer @Override public ClubUserListDto findAllClubUser(Integer page, Integer size) { - log.info("Called findAllClubUser"); + log.debug("Called findAllClubUser"); if (size <= 0) { size = Integer.MAX_VALUE; } @@ -232,14 +232,14 @@ public ClubUserListDto findAllClubUser(Integer page, Integer size) { @Override public void deleteClubUser(Long userId) { - log.info("Called deleteClubUser"); + log.debug("Called deleteClubUser"); userService.deleteClubUser(userId, LocalDateTime.now()); } @Override public void updateClubUser(Long clubId, String clubName) { - log.info("Called updateClubUser"); + log.debug("Called updateClubUser"); userService.updateClubUser(clubId, clubName); } } diff --git a/backend/src/main/java/org/ftclub/cabinet/user/service/UserServiceImpl.java b/backend/src/main/java/org/ftclub/cabinet/user/service/UserServiceImpl.java index 912f3c2ee..be7506a07 100644 --- a/backend/src/main/java/org/ftclub/cabinet/user/service/UserServiceImpl.java +++ b/backend/src/main/java/org/ftclub/cabinet/user/service/UserServiceImpl.java @@ -43,7 +43,7 @@ public class UserServiceImpl implements UserService { @Override public boolean checkUserExists(String email) { - log.info("Called checkUserExists: {}", email); + log.debug("Called checkUserExists: {}", email); User user = userOptionalFetcher.findUserByEmail(email); return user != null; } @@ -51,14 +51,14 @@ public boolean checkUserExists(String email) { /* createUser는 user를 만드는 행위만 해야될 것 같아 다음과 같이 변경했습니다. */ @Override public void createUser(String name, String email, LocalDateTime blackholedAt, UserRole role) { - log.info("Called createUser: {}", email); + log.debug("Called createUser: {}", email); User user = User.of(name, email, blackholedAt, role); userRepository.save(user); } @Override public void createClubUser(String clubName) { - log.info("Called createClubUser: {}", clubName); + log.debug("Called createClubUser: {}", clubName); if (StringUtil.isNullOrEmpty(clubName)) { throw new ControllerException(ExceptionStatus.INVALID_ARGUMENT); } else if (userOptionalFetcher.findUserByName(clubName) != null && @@ -76,7 +76,7 @@ public void createClubUser(String clubName) { @Override public boolean checkAdminUserExists(String email) { - log.info("Called checkAdminUserExists: {}", email); + log.debug("Called checkAdminUserExists: {}", email); AdminUser adminUser = userOptionalFetcher.findAdminUserByEmail(email); return adminUser != null; } @@ -84,14 +84,14 @@ public boolean checkAdminUserExists(String email) { /* createUser와 동일한 사유로 로직 수정했습니다. */ @Override public void createAdminUser(String email) { - log.info("Called createAdminUser: {}", email); + log.debug("Called createAdminUser: {}", email); AdminUser adminUser = AdminUser.of(email, AdminRole.NONE); adminUserRepository.save(adminUser); } @Override public void deleteUser(Long userId, LocalDateTime deletedAt) { - log.info("Called deleteUser: {}", userId); + log.debug("Called deleteUser: {}", userId); User user = userOptionalFetcher.getUser(userId); user.setDeletedAt(deletedAt); userRepository.save(user); @@ -99,7 +99,7 @@ public void deleteUser(Long userId, LocalDateTime deletedAt) { @Override public void deleteClubUser(Long clubId, LocalDateTime deletedAt) { - log.info("Called deleteClueUser: {}", clubId); + log.debug("Called deleteClueUser: {}", clubId); User user = userOptionalFetcher.getClubUser(clubId); Cabinet lentCabinet = lentOptionalFetcher.findActiveLentCabinetByUserId(user.getUserId()); if (lentCabinet != null) { @@ -111,14 +111,14 @@ public void deleteClubUser(Long clubId, LocalDateTime deletedAt) { @Override public void deleteAdminUser(Long adminUserId) { - log.info("Called deleteAdminUser: {}", adminUserId); + log.debug("Called deleteAdminUser: {}", adminUserId); AdminUser adminUser = userOptionalFetcher.getAdminUser(adminUserId); adminUserRepository.delete(adminUser); } @Override public void updateUserBlackholedAt(Long userId, LocalDateTime newBlackholedAt) { - log.info("Called updateUserBlackholedAt: {}", userId); + log.debug("Called updateUserBlackholedAt: {}", userId); User user = userOptionalFetcher.getUser(userId); if (user.getRole() != UserRole.USER) { return; @@ -129,7 +129,7 @@ public void updateUserBlackholedAt(Long userId, LocalDateTime newBlackholedAt) { @Override public void updateAdminUserRole(Long adminUserId, AdminRole role) { - log.info("Called updateAdminUserRole: {}", adminUserId); + log.debug("Called updateAdminUserRole: {}", adminUserId); AdminUser adminUser = userOptionalFetcher.getAdminUser(adminUserId); adminUser.changeAdminRole(role); adminUserRepository.save(adminUser); @@ -137,7 +137,7 @@ public void updateAdminUserRole(Long adminUserId, AdminRole role) { @Override public void promoteAdminByEmail(String email) { - log.info("Called promoteAdminByEmail: {}", email); + log.debug("Called promoteAdminByEmail: {}", email); AdminUser adminUser = userOptionalFetcher.getAdminUserByEmail(email); if (adminUser.getRole() == AdminRole.NONE) { adminUser.changeAdminRole(AdminRole.ADMIN); @@ -149,7 +149,7 @@ public void promoteAdminByEmail(String email) { public void banUser(Long userId, LentType lentType, LocalDateTime startedAt, LocalDateTime endedAt, LocalDateTime expiredAt) { - log.info("Called banUser: {}", userId); + log.debug("Called banUser: {}", userId); BanType banType = banPolicy.verifyForBanType(lentType, startedAt, endedAt, expiredAt); if (banType == BanType.NONE) { return; @@ -162,7 +162,7 @@ public void banUser(Long userId, LentType lentType, LocalDateTime startedAt, @Override public void deleteRecentBanHistory(Long userId, LocalDateTime today) { - log.info("Called deleteRecentBanHistory: {}", userId); + log.debug("Called deleteRecentBanHistory: {}", userId); BanHistory banHistory = userOptionalFetcher.getRecentBanHistory(userId); if (banPolicy.isActiveBanHistory(banHistory.getUnbannedAt(), today)) { banHistoryRepository.delete(banHistory); @@ -171,7 +171,7 @@ public void deleteRecentBanHistory(Long userId, LocalDateTime today) { @Override public boolean checkUserIsBanned(Long userId, LocalDateTime today) { - log.info("Called checkUserIsBanned: {}", userId); + log.debug("Called checkUserIsBanned: {}", userId); List banHistory = banHistoryRepository.findUserActiveBanList(userId, today); return (banHistory.size() != 0); @@ -179,13 +179,13 @@ public boolean checkUserIsBanned(Long userId, LocalDateTime today) { @Override public AdminRole getAdminUserRole(String email) { - log.info("Called getAdminUserRole: {}", email); + log.debug("Called getAdminUserRole: {}", email); return userOptionalFetcher.findAdminUserRoleByEmail(email); } @Override public void updateClubUser(Long clubId, String clubName) { - log.info("Called updateClubUser: {}", clubId); + log.debug("Called updateClubUser: {}", clubId); if (StringUtil.isNullOrEmpty(clubName)) { throw new ServiceException(ExceptionStatus.INVALID_ARGUMENT); } diff --git a/backend/src/main/java/org/ftclub/cabinet/utils/blackhole/manager/BlackholeManager.java b/backend/src/main/java/org/ftclub/cabinet/utils/blackhole/manager/BlackholeManager.java index 8443336d2..2c3b7ee93 100644 --- a/backend/src/main/java/org/ftclub/cabinet/utils/blackhole/manager/BlackholeManager.java +++ b/backend/src/main/java/org/ftclub/cabinet/utils/blackhole/manager/BlackholeManager.java @@ -31,7 +31,7 @@ public class BlackholeManager { * @return 카뎃 여부 */ private Boolean isValidCadet(JsonNode jsonUserInfo) { - log.debug("isValidCadet {}", jsonUserInfo); + log.info("isValidCadet {}", jsonUserInfo); return jsonUserInfo.get("cursus_users").size() >= 2; } @@ -42,7 +42,7 @@ private Boolean isValidCadet(JsonNode jsonUserInfo) { * @return LocalDateTime으로 파싱된 블랙홀 날짜 */ private LocalDateTime parseBlackholedAt(JsonNode jsonUserInfo) { - log.debug("parseBlackholedAt {}", jsonUserInfo); + log.info("parseBlackholedAt {}", jsonUserInfo); JsonNode JsonBlackholedAt = jsonUserInfo.get("cursus_users").get(1).get("blackholed_at"); if (JsonBlackholedAt == null || JsonBlackholedAt.asText().equals("null")) { return null; @@ -58,7 +58,7 @@ private LocalDateTime parseBlackholedAt(JsonNode jsonUserInfo) { * @return 블랙홀에 빠졌는지 여부 */ private Boolean isBlackholed(LocalDateTime blackholedAtDate, LocalDateTime now) { - log.debug("isBlackholed {} {}", blackholedAtDate, now); + log.info("isBlackholed {} {}", blackholedAtDate, now); if (blackholedAtDate == null || blackholedAtDate.isAfter(now)) { return false; } else { @@ -85,7 +85,7 @@ private void handleNotCadet(UserBlackholeInfoDto userBlackholeInfoDto, LocalDate * @param now 현재 시간 */ private void handleBlackholed(UserBlackholeInfoDto userBlackholeInfoDto, LocalDateTime now) { - log.warn("{}는 블랙홀에 빠졌습니다.", userBlackholeInfoDto); + log.info("{}는 블랙홀에 빠졌습니다.", userBlackholeInfoDto); lentService.terminateLentCabinet(userBlackholeInfoDto.getUserId()); userService.deleteUser(userBlackholeInfoDto.getUserId(), now); } @@ -120,7 +120,7 @@ private void handleHttpClientError(UserBlackholeInfoDto userBlackholeInfoDto, Lo } public void handleBlackhole(UserBlackholeInfoDto userBlackholeInfoDto) { - log.debug("called handleBlackhole {}", userBlackholeInfoDto); + log.info("called handleBlackhole {}", userBlackholeInfoDto); LocalDateTime now = LocalDateTime.now(); try { JsonNode jsonUserInfo = ftAPIManager.getFtUsersInfoByName( diff --git a/backend/src/main/java/org/ftclub/cabinet/utils/leave/absence/LeaveAbsenceManager.java b/backend/src/main/java/org/ftclub/cabinet/utils/leave/absence/LeaveAbsenceManager.java index 75ecc89bf..5f37b937e 100644 --- a/backend/src/main/java/org/ftclub/cabinet/utils/leave/absence/LeaveAbsenceManager.java +++ b/backend/src/main/java/org/ftclub/cabinet/utils/leave/absence/LeaveAbsenceManager.java @@ -27,7 +27,7 @@ private Boolean isLeaveAbsence(JsonNode jsonUserInfo) { } public void handleLeaveAbsence(Long userId, String name) { - log.info("called handleLeaveAbsence {} {}", userId, name); + log.debug("called handleLeaveAbsence {} {}", userId, name); try { JsonNode jsonUserInfo = ftAPIManager.getFtUsersInfoByName(name); if (isLeaveAbsence(jsonUserInfo)) { diff --git a/backend/src/main/java/org/ftclub/cabinet/utils/mail/EmailSender.java b/backend/src/main/java/org/ftclub/cabinet/utils/mail/EmailSender.java index d36f6f93f..116cb0acd 100644 --- a/backend/src/main/java/org/ftclub/cabinet/utils/mail/EmailSender.java +++ b/backend/src/main/java/org/ftclub/cabinet/utils/mail/EmailSender.java @@ -25,7 +25,7 @@ public void sendMail(String name, String to, String subject, String template) throws MessagingException, MailException { log.info("called EmailSender for {}, {}, {}", name, to, subject); if (gmailProperties.getIsProduction() == false) { - log.info("개발 환경이므로 메일을 보내지 않습니다."); + log.debug("개발 환경이므로 메일을 보내지 않습니다."); return; } MimeMessage message = javaMailSender.createMimeMessage(); diff --git a/backend/src/main/java/org/ftclub/cabinet/utils/overdue/manager/OverdueManager.java b/backend/src/main/java/org/ftclub/cabinet/utils/overdue/manager/OverdueManager.java index 0dde34702..23bf71c27 100644 --- a/backend/src/main/java/org/ftclub/cabinet/utils/overdue/manager/OverdueManager.java +++ b/backend/src/main/java/org/ftclub/cabinet/utils/overdue/manager/OverdueManager.java @@ -71,4 +71,4 @@ public void handleOverdue(ActiveLentHistoryDto activeLent) { e.printStackTrace(); } } -} \ No newline at end of file +} diff --git a/backend/src/main/java/org/ftclub/cabinet/utils/scheduler/SystemScheduler.java b/backend/src/main/java/org/ftclub/cabinet/utils/scheduler/SystemScheduler.java index d40ce4b5b..00c1ec84d 100644 --- a/backend/src/main/java/org/ftclub/cabinet/utils/scheduler/SystemScheduler.java +++ b/backend/src/main/java/org/ftclub/cabinet/utils/scheduler/SystemScheduler.java @@ -83,4 +83,4 @@ public void checkNoRiskOfBlackhole() { } } } -} \ No newline at end of file +} diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index c5de99843..2e00e6d9f 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -7,6 +7,8 @@ spring: import: classpath:application-auth.yml, classpath:application-mail.yml activate: on-profile: prod +logging: + config: classpath:log4j2-prod.yml --- #개발서버 환경 @@ -17,6 +19,8 @@ spring: import: classpath:application-auth.yml, classpath:application-mail.yml activate: on-profile: dev +logging: + config: classpath:log4j2-dev.yml --- #로컬 환경 @@ -27,5 +31,8 @@ spring: import: classpath:application-auth.yml, classpath:application-mail.yml activate: on-profile: local +logging: + config: classpath:log4j2-local.yml + --- diff --git a/backend/src/main/resources/log4j2-dev.yml b/backend/src/main/resources/log4j2-dev.yml new file mode 100644 index 000000000..22a7a437b --- /dev/null +++ b/backend/src/main/resources/log4j2-dev.yml @@ -0,0 +1,54 @@ +Configuration: + status: info + + Properties: + property: + name: pattern + value: "%style{%d{yyyy-MM-dd HH:mm:ss}}{white} %highlight{%-5level }[%style{%t}{bright,blue}] %style{%X}{normal, white} %style{%C{1}}{bright,yellow}: %msg%n%throwable" + + Appenders: + Console: + name: console + target: SYSTEM_OUT + PatternLayout: + pattern: ${pattern} + + RollingFile: + name: rollingFile + # 파일 저장 위치를 어디로? + fileName: logs/42cabi.log + filePattern: logs/42cabi-%d{yyyy-MM-dd}-%i.log.gz + PatternLayout: + pattern: ${pattern} + Policies: + # 1일 단위로 로그를 압축해서 저장 + TimeBasedTriggeringPolicy: + interval: 1 + modulate: true + DefaultRolloverStrategy: + Delete: + basePath: logs + ifFileName: + glob: "42cabi-*.log.gz" + # 30일 이상된 로그는 삭제 + ifLastModified: + age: "30d" + max: 30 + + Loggers: + logger: + - + name: org.springframework + level: info + additivity: false + AppenderRef: + - ref: console + - ref: rollingFile + + - + name: org.ftclub.cabinet + level: info + additivity: false + AppenderRef: + - ref: console + - ref: rollingFile diff --git a/backend/src/main/resources/log4j2-local.yml b/backend/src/main/resources/log4j2-local.yml new file mode 100644 index 000000000..83f5a42a6 --- /dev/null +++ b/backend/src/main/resources/log4j2-local.yml @@ -0,0 +1,48 @@ +Configuration: + status: debug + + Properties: + property: + name: pattern + value: "%style{%d{yyyy-MM-dd HH:mm:ss}}{white} %highlight{%-5level }[%style{%t}{bright,blue}] %style{%X}{normal, white} %style{%C{1}}{bright,yellow}: %msg%n%throwable" + + Appenders: + Console: + name: console + target: SYSTEM_OUT + PatternLayout: + pattern: ${pattern} + + Loggers: + logger: + - + name: org.springframework + # local 환경에서는 debug, production 환경에서는 info + level: debug + additivity: false + AppenderRef: + - ref: console + - + name: org.ftclub.cabinet + level: debug + additivity: false + AppenderRef: + - ref: console + + # SQL문 확인을 위한 설정 (시작) + # sql을 봐야한다면 해당 부분 주석 해제하면 됨. + # trace로 해놓는 이유는 JDBC 파라미터를 보기 위함 +# - +# name: org.hibernate.type +# level: trace +# additivity: false +# AppenderRef: +# ref: console +# +# - +# name: org.hibernate.SQL +# level: debug +# additivity: false +# AppenderRef: +# ref: console + # SQL문 확인을 위한 설정 (끝) diff --git a/backend/src/main/resources/log4j2-prod.yml b/backend/src/main/resources/log4j2-prod.yml new file mode 100644 index 000000000..22a7a437b --- /dev/null +++ b/backend/src/main/resources/log4j2-prod.yml @@ -0,0 +1,54 @@ +Configuration: + status: info + + Properties: + property: + name: pattern + value: "%style{%d{yyyy-MM-dd HH:mm:ss}}{white} %highlight{%-5level }[%style{%t}{bright,blue}] %style{%X}{normal, white} %style{%C{1}}{bright,yellow}: %msg%n%throwable" + + Appenders: + Console: + name: console + target: SYSTEM_OUT + PatternLayout: + pattern: ${pattern} + + RollingFile: + name: rollingFile + # 파일 저장 위치를 어디로? + fileName: logs/42cabi.log + filePattern: logs/42cabi-%d{yyyy-MM-dd}-%i.log.gz + PatternLayout: + pattern: ${pattern} + Policies: + # 1일 단위로 로그를 압축해서 저장 + TimeBasedTriggeringPolicy: + interval: 1 + modulate: true + DefaultRolloverStrategy: + Delete: + basePath: logs + ifFileName: + glob: "42cabi-*.log.gz" + # 30일 이상된 로그는 삭제 + ifLastModified: + age: "30d" + max: 30 + + Loggers: + logger: + - + name: org.springframework + level: info + additivity: false + AppenderRef: + - ref: console + - ref: rollingFile + + - + name: org.ftclub.cabinet + level: info + additivity: false + AppenderRef: + - ref: console + - ref: rollingFile diff --git a/backend/src/main/resources/log4j2.xml b/backend/src/main/resources/log4j2.xml deleted file mode 100644 index 06564476a..000000000 --- a/backend/src/main/resources/log4j2.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - %style{%d{yyyy-MM-dd HH:mm:ss}}{white} %highlight{%-5level }[%style{%t}{bright,blue}] %style{%C{1}}{bright,yellow}: %msg%n%throwable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dump_cabi_main.sql b/dump_cabi_main.sql deleted file mode 100644 index e69de29bb..000000000