xiangfu0 commented on code in PR #9180:
URL: https://github.com/apache/pinot/pull/9180#discussion_r940684024


##########
pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerLogger.java:
##########
@@ -0,0 +1,83 @@
+/**
+ * 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.pinot.broker.api.resources;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiKeyAuthDefinition;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.Authorization;
+import io.swagger.annotations.SecurityDefinition;
+import io.swagger.annotations.SwaggerDefinition;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.pinot.common.utils.LoggerUtils;
+
+import static 
org.apache.pinot.spi.utils.CommonConstants.SWAGGER_AUTHORIZATION_KEY;
+
+
+/**
+ * Logger resource.
+ */
+@Api(tags = "Logger", authorizations = {@Authorization(value = 
SWAGGER_AUTHORIZATION_KEY)})
+@SwaggerDefinition(securityDefinition = 
@SecurityDefinition(apiKeyAuthDefinitions = @ApiKeyAuthDefinition(name =
+    HttpHeaders.AUTHORIZATION, in = 
ApiKeyAuthDefinition.ApiKeyLocation.HEADER, key = SWAGGER_AUTHORIZATION_KEY)))
+@Path("/loggers/")
+public class PinotBrokerLogger {
+
+  @GET
+  @Path("")
+  @Produces(MediaType.APPLICATION_JSON)
+  @ApiOperation(value = "Get all the loggers", notes = "Return all the logger 
names")
+  public List<String> getLoggers(
+      @ApiParam(value = "Name of the table", required = true) 
@PathParam("tableName") String tableNameWithType) {
+    return LoggerUtils.getAllLoggers();
+  }
+
+  @GET
+  @Path("{loggerName}")
+  @Produces(MediaType.APPLICATION_JSON)
+  @ApiOperation(value = "Get logger configs", notes = "Return logger info")
+  public Map<String, Object> getLogger(
+      @ApiParam(value = "Logger name", required = true) 
@PathParam("loggerName") String loggerName) {

Review Comment:
   The logger name is defined by the user: e.g. this log4j2.xml: 
https://github.com/apache/pinot/blob/master/pinot-tools/src/main/resources/log4j2.xml#L48
   
   It will have 3 loggers: 
["root","org.reflections","org.apache.pinot.tools.admin"]
   
   Note that appenders level are not changeable, which means the appender 
`console`'s level is not changeable from this API.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to