Skip to content

Commit 2fda1bf

Browse files
committed
chore: 로깅 출력 레벨 수정 및 디스코드 에러 메세지 수정
1 parent 2a9dba8 commit 2fda1bf

File tree

5 files changed

+196
-31
lines changed

5 files changed

+196
-31
lines changed

src/main/kotlin/com/ddd/sonnypolabobe/global/security/JwtExceptionFilter.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ class JwtExceptionFilter(
4747
"Parameters - ${getRequestParams(request)} \n" +
4848
"Request body - ${getRequestBody(requestWrapper)} \n" +
4949
"Response body - ${getResponseBody(responseWrapper)}"
50-
logger().error(message)
5150
if (responseWrapper.status >= 400 && getResponseBody(responseWrapper).contains(
5251
CustomErrorCode.INTERNAL_SERVER_EXCEPTION.message
5352
)
5453
) {
54+
logger().error(message)
5555
this.discordApiClient.sendErrorLog(message)
5656
}
5757
}

src/main/resources/application-dev.yml

-8
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ spring:
99
hikari:
1010
minimum-idle: 2
1111
maximum-pool-size: 2
12-
# jpa:
13-
# hibernate:
14-
# naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
15-
# ddl-auto: none
16-
# show-sql: true
17-
# properties:
18-
# hibernate:
19-
# format_sql: true
2012
jooq:
2113
sql-dialect: mysql
2214

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
spring:
22
config:
33
activate:
4-
on-profile: local
4+
on-profile: dev
55
datasource:
6-
url: jdbc:mysql://localhost:3306/polabo?useUnicode=true&charset=utf8mb4&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull
7-
username: polabo
8-
password: polabo
6+
url: ENC(pz7EEQu20leZT3uKvGuyvt7YhmLSOJ03yp09o3HSmvk8QqSORYES8Y0iqtjYt3An0uSXVGvd+PdNxXF4h1KXbLm6aMSl2K9gWh2XR5GbIpPAKasqkuha20MGAVckb9NRQC3s0IowzCMvt+jOv0Z1RrAnsfzJy08ZbWe41Slcz/VaQU1hSF6HVohMUrBPApDELlW558sM0jWPfi7NPYNGSlyB4f3bYa0WqjOIAAKPVb3ptvrQwmN7Wg==)
7+
username: ENC(6B0VWBlhLIFr2ynq8c8jug==)
8+
password: ENC(klG0liQdqtFK3VDxA89xC1ZIYYzUIz08)
99
hikari:
1010
minimum-idle: 2
1111
maximum-pool-size: 2
12-
# jpa:
13-
# hibernate:
14-
# naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
15-
# ddl-auto: none
16-
# show-sql: true
17-
# properties:
18-
# hibernate:
19-
# format_sql: true
2012
jooq:
2113
sql-dialect: mysql
2214

@@ -36,15 +28,18 @@ aws:
3628
domain: ENC(5AUXhCDMkJlNZa6tI8NIRY3z1kXAtgF0Bb6N3DyujlkOg0iJqK6mV7YYd5rMm1X3)
3729

3830
running:
39-
name: local
31+
name: dev
4032

4133
jwt:
4234
access-key: ENC(43L/PYzgJ86ciTJurdPNLgq49TUMtOgF6ke+Z7d4/wEN2WMu2iakpdDlD2C8d9GUNZzFl0Y9ftK4tk545L5TSv05I5OgbYkBGf2m5O51cjUZmSRg897e+5o+Z5aLgwb1+9tcOcawZR/X9lgkA5hTxlzGc7DHf1vMepLDnbaQBk0I56ieDV314JEEqIaeID72)
35+
refresh-key: ENC(Tg3e1h7BGfmOmB1kbSHW/Wdi9QQh34DR6XsD6Su7GkMH236k11Ffl9siE2FsDVvJX3MRmF7szRveRfUZR4DbgiYXzSoC35yGQHAiljtt7Cb77QuofiCLpKMetX6B3egTHFpoJWHqrsn1IRYi31rcYLIWnGff0vAMCy3IX2jnI2PzjVgzW0/UjpqMXspUj3rIuDjK926M/fCijH+xgswjVNqJcnQQmIk+5FUTSyut5tY=)
4336
validity:
44-
access-seconds: 86400000
37+
access-seconds: ENC(KeRwqvZAr0MfEVmxw8nBQQFEITQ0v/Fl)
38+
refresh-seconds: ENC(RvppXDZLdo/Yw2ycPoRogGU9rumQgnQy)
4539

4640
logging:
4741
discord:
4842
webhook-uri: ENC(yfeX3WHXQdxkVtasNl5WLv6M/YlN+dVFUurjxGIddstjjipt+KryWKvLu1wDmdGjpuEhUHyaABg4gFWRMk9gNlxSQEE/G1twbuvkOvT0pyFWycVVJ6ryU/v9pDBOS1PSKJY7L3NP66gOGnam6nOvf0Y+F45zZvXj8/sdtR6N798U6fGjFDxOLQ==)
43+
4944
level:
50-
root: INFO
45+
root: ERROR

src/main/resources/logback-spring.xml

+1-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@
2121

2222
<springProfile name="dev">
2323
<property name="appName" value="dev-api"/>
24-
25-
<logger name="org.jooq" level="DEBUG" additivity="false">
26-
<appender-ref ref="CONSOLE"/>
27-
</logger>
28-
29-
<root level="INFO">
24+
<root level="ERROR">
3025
<appender-ref ref="CONSOLE"/>
3126
</root>
3227
</springProfile>

src/test/kotlin/com/ddd/sonnypolabobe/SonnyPolaboBeApplicationTests.kt

+184-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,195 @@ package com.ddd.sonnypolabobe
22

33
import org.junit.jupiter.api.Test
44
import org.springframework.boot.test.context.SpringBootTest
5+
import java.util.*
56

6-
@SpringBootTest
7+
//@SpringBootTest
78
class SonnyPolaboBeApplicationTests {
89

910
@Test
1011
fun contextLoads() {
12+
println(solution(2, 10, intArrayOf(7,4,5,6))) // 8
13+
// println(solution(arrayOf(
14+
// intArrayOf(1,2,1),
15+
// intArrayOf(8,2,0),
16+
// intArrayOf(1,7,2)
17+
// ), intArrayOf(0, 0))) // true
18+
// println(solution(arrayOf(
19+
// intArrayOf(1,2,3,2,1),
20+
// intArrayOf(4,2,0,7,2),
21+
// intArrayOf(1,3,3,8,1),
22+
// intArrayOf(2,0,1,1,1),
23+
// intArrayOf(8,2,8,1,1)
24+
// ), intArrayOf(0, 0))) // false
25+
26+
// println(solution(arrayOf(
27+
// intArrayOf(1,2,3,2,1),
28+
// intArrayOf(4,2,0,7,1),
29+
// intArrayOf(1,3,2,8,1),
30+
// intArrayOf(2,0,1,1,1),
31+
// intArrayOf(8,2,1,2,1)
32+
// ), intArrayOf(4,3)
33+
// )) // true
34+
// println(solution(
35+
// intArrayOf(23), // 고객 수
36+
// intArrayOf(12, 3, 19), // 모델 처리량
37+
// intArrayOf(28, 10, 35) // 모델 비용
38+
// ))
39+
1140
}
1241

42+
fun solution(bridge_length: Int, weight: Int, truck_weights: IntArray): Int {
43+
var answer = 0
44+
45+
val queue: Queue<Int> = LinkedList()
46+
var totalWeight = 0
47+
48+
for(truck in truck_weights) {
49+
queue.add(truck)
50+
}
51+
52+
val bridge = LinkedList(List(bridge_length) { 0 })
53+
54+
while(bridge.isNotEmpty()) {
55+
answer++
56+
57+
totalWeight -= bridge.poll() // 다리를 건넌 트럭의 무게를 빼준다.
58+
59+
if(queue.isNotEmpty()) {
60+
val nextWeight = queue.peek()
61+
if(nextWeight + totalWeight <= weight ) {
62+
totalWeight += nextWeight
63+
bridge.add(queue.poll())
64+
} else {
65+
bridge.add(0)
66+
}
67+
}
68+
69+
70+
}
71+
72+
73+
// while (bridge.isNotEmpty()) {
74+
// answer++
75+
// totalWeight -= bridge.poll()
76+
//
77+
// if (waiting.isNotEmpty()) {
78+
// val nextWeight = waiting.peek()
79+
//
80+
// if (totalWeight + nextWeight <= weight) {
81+
// totalWeight += nextWeight
82+
// bridge.add(waiting.poll())
83+
// } else {
84+
// bridge.add(0)
85+
// }
86+
// }
87+
// }
88+
return answer
89+
}
90+
91+
92+
// fun solution(map : Array<IntArray>, entrancePoint: IntArray) : Boolean {
93+
// // 출발점에서 닭가슴살을 찾을 수 있는지 여부가 answer
94+
// // 닭가슴살은 7
95+
// // 액상 과당은 0, 초콜릿은 8 이라고 할 때
96+
// // map에서 출발점을 기준으로는 좌우로만 갈 수 있다.
97+
// // 이후에는 위 아래로 갈 수 있다.
98+
// // 그 다음에는 좌우로만 갈 수 있다. 이 구성을 반복한다고 할 때 이동 방향으로는 현재 위치의 숫자만큼 간다.
99+
// // 이동의 도착점에 액상 과당이나 초콜릿이 있다면 false를 반환한다.
100+
// // 영역을 벗어나도 false를 반환한다.
101+
//
102+
// var answer = false
103+
// var x = entrancePoint[0]
104+
// var y = entrancePoint[1]
105+
// var direction = if (x % 2 == 0) 0 else 2
106+
// var nextX = 0
107+
// var nextY = 0
108+
//
109+
// while (true) {
110+
// if (map[x][y] == 7) {
111+
// answer = true
112+
// break
113+
// }
114+
// if (map[x][y] == 0 || map[x][y] == 8) {
115+
// break
116+
// }
117+
// when (direction) {
118+
// 0 -> {
119+
// nextX = x
120+
// nextY = y + map[x][y]
121+
// }
122+
// 1 -> {
123+
// nextX = x + map[x][y]
124+
// nextY = y
125+
// }
126+
// 2 -> {
127+
// nextX = x
128+
// nextY = y - map[x][y]
129+
// }
130+
// 3 -> {
131+
// nextX = x - map[x][y]
132+
// nextY = y
133+
// }
134+
// }
135+
// if (nextX < 0 || nextX >= map.size || nextY < 0 || nextY >= map[0].size) {
136+
// break
137+
// }
138+
// x = nextX
139+
// y = nextY
140+
// direction = (direction + 1) % 4 // 방향을 바꾼다.
141+
// }
142+
// return answer
143+
//
144+
// }
145+
146+
// fun solution(customers : IntArray, modelCapacities: IntArray, modelCosts: IntArray) : Int {
147+
// var answer = 0
148+
//
149+
// // 매 시간 고객의 접수 건을 담고 있는 배열 customers
150+
// // 각 모델의 처리량을 담고 있는 배열 modelCapacities 예를 들면, A-12, B-3, C-19
151+
// // 각 모델의 비용을 담고 있는 배열 modelCosts 예를 들면, A-28, B-10, C-35
152+
// // 각 모델은 1시간에 위 처리량만큼 처리할 수 있다.
153+
//
154+
// // 최소 비용으로 처리하고자 할 때, 그 비용을 반환한다.
155+
//
156+
// // 모델의 처리량과 비용을 (처리량, 비용) 쌍으로 묶고, 처리량이 큰 순으로 정렬
157+
// val pair = modelCapacities.zip(modelCosts).sortedByDescending { it.first }
158+
//
159+
// for (customer in customers) {
160+
// var minCost = Int.MAX_VALUE
161+
//
162+
// for (i in pair.indices) {
163+
// val (capacity, cost) = pair[i]
164+
// val fullModelsNeeded = customer / capacity
165+
// val remainder = customer % capacity
166+
//
167+
// // 총 비용 계산
168+
// var totalCost = cost * fullModelsNeeded
169+
//
170+
// // 잔여 고객 처리 비용 추가
171+
// if (remainder > 0) {
172+
// // 잔여 고객을 처리하기 위한 최소 비용을 계산
173+
// var extraCost = Int.MAX_VALUE
174+
// for (j in pair.indices) {
175+
// val (extraCapacity, extraCostValue) = pair[j]
176+
// if (extraCapacity >= remainder) {
177+
// extraCost = minOf(extraCost, extraCostValue)
178+
// }
179+
// }
180+
// totalCost += extraCost
181+
// }
182+
//
183+
// // 최소 비용 업데이트
184+
// minCost = minOf(minCost, totalCost)
185+
// }
186+
// answer += minCost
187+
// }
188+
//
189+
// return answer
190+
// }
191+
192+
193+
194+
195+
13196
}

0 commit comments

Comments
 (0)