-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce logger REST API to manage log level at runtime #9161
Conversation
It's possible to create new logger with log level, list all loggers defined with loglevel, change level on a given logger, etc Change-Id: I1c105aca33cc88f90270ade4d792d3a75191740a Signed-off-by: Florent BENOIT <fbenoit@redhat.com>
wsmaster/che-core-api-logger/pom.xml
Outdated
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-db</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it's provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the dependency
wsmaster/che-core-api-logger/pom.xml
Outdated
<dependency> | ||
<groupId>com.google.inject.extensions</groupId> | ||
<artifactId>guice-persist</artifactId> | ||
<scope>provided</scope> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why its provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the dependency
* @author Florent Benoit | ||
*/ | ||
@Api(value = "/logger", description = "Logger REST API") | ||
@Path("/logger") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make sure this service is protected with authentification in multi-user mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now it was not enabled in multi user mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
permission mechanism added
@ApiResponses({ | ||
@ApiResponse(code = 200, message = "The loggers successfully fetched"), | ||
}) | ||
public List<LoggerDto> getLoggers() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add pagination here? with limit 30 by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could yes but for now there is only 3 loggers
https://github.com/eclipse/che-lib/blob/master/che-tomcat8-slf4j-logback/src/assembly/conf/logback.xml#L47-L49
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added pagination
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool and useful feature 👍
But It looks like authorization is missed here. I guess It's not OK to this API should is available for all authenticated users. Or I missed something?
wsmaster/che-core-api-logger/pom.xml
Outdated
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-db-vendor-h2</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revise dependencies list, I guess you don't need che-core-db-vendor-h2, org.eclipse.persistence.jpa dependencies, do you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I need to cleanup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@ApiResponses({ | ||
@ApiResponse(code = 200, message = "The logger successfully created"), | ||
}) | ||
public LoggerDto createLogger( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this method should be covered with System#MANAGE_SYSTEM
permission actions. Or maybe even all methods of this service. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
permission mechanism added
I should have specified that for now there is now permission check on this service, mainly because I added only this service on the single user and not the multi user. But yes I wanted to include it as well for multi-user, just wanted to discuss on how you were seeing the permission that would be required to call it. It seems |
Change-Id: I626a03fde2ea2ecc65bee50dbae9f4135b46fdcc Signed-off-by: Florent BENOIT <fbenoit@redhat.com>
I think yes. |
Change-Id: I4596f22ae6f28a9317d147b4f29bb090ddb7e9c6 Signed-off-by: Florent BENOIT <fbenoit@redhat.com>
ok I have added permission stuff and then enabled as well logger api for multi user mode |
Change-Id: I59a1136c450103dec23bf4b1b5781a9fbeea1b91 Signed-off-by: Florent BENOIT <fbenoit@redhat.com>
Change-Id: I56aa8df29c8ee3ab876c97812b6a139854914a0f Signed-off-by: Florent BENOIT <fbenoit@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
</dtoPackages> | ||
<outputDirectory>${dto-generator-out-directory}</outputDirectory> | ||
<genClassName>org.eclipse.che.api.logger.server.dto.DtoServerImpls</genClassName> | ||
<impl>server</impl> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say that it is better to generate DTO server implementations in server module. Because a shared module is supposed to contain only shared things which are compatible with dependent modules.
So GWT module will get classes that can't be used there.
WDYT? Does it make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied content from workspace-shared module so maybe if I'm doing it wrong there is an issue with this module as well ?
it's up to you, let me know what is the better approach.
maybe client or server should be additional classifier artifacts
main artifacts = interfaces
client classifier = for gwt
server classifier = for server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea with classifiers.
Is an issue with this module as well
I think yes.
I think now we can leave it as it is. And later rework it in all places.
@skabashnyuk WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can revise it later.
<plugin> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-api-dto-maven-plugin</artifactId> | ||
<version>${project.version}</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should there ${che.version}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@riuvshin
it's the same than here
https://github.com/eclipse/che/blob/master/wsmaster/che-core-api-user-shared/pom.xml#L54
or here https://github.com/eclipse/che/blob/master/wsmaster/che-core-api-workspace-shared/pom.xml#L59
what should I do ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, ok, in theory both are fine, but I thought we use che.version in such places so it seems it is ok
What does this PR do?
following this previous comment #8997 (comment)
with this Rest API, it's possible to create new logger with log level, list all loggers defined with loglevel, change level on a given logger, etc
On multi-user,
System#MANAGE_SYSTEM
permission is required.Change-Id: I1c105aca33cc88f90270ade4d792d3a75191740a
Signed-off-by: Florent BENOIT fbenoit@redhat.com
What issues does this PR fix or reference?
#8997