|
| 1 | +/* |
| 2 | + * Copyright 2024 NAVER Corp. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package com.navercorp.pinpoint.it.plugin.logback; |
| 17 | + |
| 18 | +import com.navercorp.pinpoint.it.plugin.utils.AgentPath; |
| 19 | +import com.navercorp.pinpoint.it.plugin.utils.PluginITConstants; |
| 20 | +import com.navercorp.pinpoint.test.plugin.*; |
| 21 | +import org.junit.jupiter.api.Assertions; |
| 22 | +import org.junit.jupiter.api.Test; |
| 23 | + |
| 24 | +@PluginForkedTest |
| 25 | +@PinpointAgent(AgentPath.PATH) |
| 26 | +@Dependency({"ch.qos.logback:logback-classic:[1.0.13],[1.1.0,1.1.11],[1.2.0,1.2.6]", "org.slf4j:slf4j-api:1.7.12", PluginITConstants.VERSION}) |
| 27 | +@ImportPlugin({"com.navercorp.pinpoint:pinpoint-logback-plugin"}) |
| 28 | +@PinpointConfig("pinpoint-spring-bean-test.config") |
| 29 | +@JvmArgument({"-DtestLoggerEnable=false", "-Dprofiler.logback.logging.pattern.full_replace.with=%d{yyyy-MM-dd HH:mm:ss} [%p] [%t] %c [TxId:%X{PtxId} ReqId:%X{PreqId}] -LogbackIT- %m%n"}) |
| 30 | +@TransformInclude("org.slf4j.") |
| 31 | +public class LogbackPatternFullReplaceIT extends LogbackTestBase { |
| 32 | + |
| 33 | + @Test |
| 34 | + public void test() { |
| 35 | + checkMDC(); |
| 36 | + } |
| 37 | + |
| 38 | + @Test |
| 39 | + public void patternUpdate() { |
| 40 | + String log = checkPatternUpdate(); |
| 41 | + Assertions.assertTrue(log.contains("-LogbackIT-"), "contains full-replace string LogbackIT"); |
| 42 | + } |
| 43 | + |
| 44 | +} |
0 commit comments