hailin0 commented on code in PR #3025: URL: https://github.com/apache/incubator-seatunnel/pull/3025#discussion_r990733071
########## seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/log/Log4j2HttpGetCommandProcessor.java: ########## @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.seatunnel.engine.server.log; + +import com.hazelcast.internal.ascii.TextCommandService; +import com.hazelcast.internal.ascii.rest.HttpCommandProcessor; +import com.hazelcast.internal.ascii.rest.HttpGetCommand; +import com.hazelcast.internal.ascii.rest.HttpGetCommandProcessor; +import com.hazelcast.internal.json.JsonObject; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.core.config.LoggerConfig; + +import java.util.Map; + +public class Log4j2HttpGetCommandProcessor extends HttpCommandProcessor<HttpGetCommand> { + + private final HttpGetCommandProcessor original; + + public Log4j2HttpGetCommandProcessor(TextCommandService textCommandService) { + this(textCommandService, new HttpGetCommandProcessor(textCommandService)); + } + + public Log4j2HttpGetCommandProcessor(TextCommandService textCommandService, + HttpGetCommandProcessor httpGetCommandProcessor) { + super(textCommandService, textCommandService.getNode().getLogger(Log4j2HttpGetCommandProcessor.class)); + this.original = httpGetCommandProcessor; + } + + @Override + public void handleRejection(HttpGetCommand request) { + handle(request); + } + + @Override + public void handle(HttpGetCommand request) { + String uri = request.getURI(); + if (uri.startsWith(HttpCommandProcessor.URI_LOG_LEVEL)) { + outputAllLoggerLevel(request); Review Comment: example <img width="580" alt="image" src="https://user-images.githubusercontent.com/14371345/194738709-d9163420-3def-42ce-b1e7-7ef308a80ae5.png"> ########## seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/log/Log4j2HttpPostCommandProcessor.java: ########## @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.seatunnel.engine.server.log; + +import static com.hazelcast.internal.ascii.rest.HttpStatusCode.SC_500; + +import com.hazelcast.internal.ascii.TextCommandService; +import com.hazelcast.internal.ascii.rest.HttpCommandProcessor; +import com.hazelcast.internal.ascii.rest.HttpPostCommand; +import com.hazelcast.internal.ascii.rest.HttpPostCommandProcessor; +import com.hazelcast.internal.json.JsonObject; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.config.Configurator; +import org.apache.logging.log4j.core.config.LoggerConfig; + +public class Log4j2HttpPostCommandProcessor extends HttpCommandProcessor<HttpPostCommand> { + + private final HttpPostCommandProcessor original; + + public Log4j2HttpPostCommandProcessor(TextCommandService textCommandService) { + this(textCommandService, new HttpPostCommandProcessor(textCommandService)); + } + + public Log4j2HttpPostCommandProcessor(TextCommandService textCommandService, + HttpPostCommandProcessor httpPostCommandProcessor) { + super(textCommandService, textCommandService.getNode().getLogger(Log4j2HttpPostCommandProcessor.class)); + this.original = httpPostCommandProcessor; + } + + @Override + public void handleRejection(HttpPostCommand request) { + handle(request); + } + + @Override + public void handle(HttpPostCommand request) { + String uri = request.getURI(); + if (uri.startsWith(HttpCommandProcessor.URI_LOG_LEVEL)) { + setLoggerLevel(request); Review Comment: example <img width="1112" alt="image" src="https://user-images.githubusercontent.com/14371345/194738748-5c23fa97-1e89-4cfa-9604-3b33162a5ca0.png"> <img width="546" alt="image" src="https://user-images.githubusercontent.com/14371345/194738757-fa182c04-a839-459a-aa32-91b4bcaa1c05.png"> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
