use of org.springframework.boot.actuate.endpoint.annotation.WriteOperation in project spring-boot by spring-projects.
the class LoggersEndpoint method configureLogLevel.
@WriteOperation
public void configureLogLevel(@Selector String name, @Nullable LogLevel configuredLevel) {
Assert.notNull(name, "Name must not be empty");
LoggerGroup group = this.loggerGroups.get(name);
if (group != null && group.hasMembers()) {
group.configureLogLevel(configuredLevel, this.loggingSystem::setLogLevel);
return;
}
this.loggingSystem.setLogLevel(name, configuredLevel);
}
use of org.springframework.boot.actuate.endpoint.annotation.WriteOperation in project cas by apereo.
the class LoggingConfigurationEndpoint method updateLoggerLevel.
/**
* Looks up the logger in the logger factory,
* and attempts to find the real logger instance
* based on the underlying logging framework
* and retrieve the logger object. Then, updates the level.
* This functionality at this point is heavily dependant
* on the log4j API.
*
* @param loggerName the logger name
* @param loggerLevel the logger level
* @param additive the additive nature of the logger
*/
@WriteOperation
@Operation(summary = "Update logger level for a logger name", parameters = { @Parameter(name = "loggerName", required = true), @Parameter(name = "loggerLevel", required = true), @Parameter(name = "additive") })
public void updateLoggerLevel(@Selector final String loggerName, final String loggerLevel, final boolean additive) {
val loggerConfigs = getLoggerConfigurations();
loggerConfigs.stream().filter(cfg -> cfg.getName().equals(loggerName)).forEachOrdered(cfg -> {
cfg.setLevel(Level.getLevel(loggerLevel));
cfg.setAdditive(additive);
});
this.loggerContext.updateLoggers();
}
use of org.springframework.boot.actuate.endpoint.annotation.WriteOperation in project cas by apereo.
the class CasReleaseAttributesReportEndpoint method releaseAttributes.
/**
* Method that accepts a JSON body through a POST method to receive user credentials and only returns a
* map of attributes released for the authenticated user.
*
* @param username - the username
* @param password - the password
* @param service - the service id
* @return - the map
*/
@WriteOperation
@Operation(summary = "Get collection of released attributes for the user and application", parameters = { @Parameter(name = "username", required = true), @Parameter(name = "password", required = true), @Parameter(name = "service", required = true) })
public Map<String, Object> releaseAttributes(final String username, final String password, final String service) {
val map = releasePrincipalAttributes(username, password, service);
val assertion = (ImmutableAssertion) map.get("assertion");
return Map.of("uid", username, "attributes", assertion.getPrimaryAuthentication().getPrincipal().getAttributes());
}
Aggregations