-
Notifications
You must be signed in to change notification settings - Fork 60
LUTECE-2196 : Allow to reload the log4j configuration at runtime #140
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ | |
import fr.paris.lutece.portal.service.i18n.I18nService; | ||
import fr.paris.lutece.portal.service.security.SecurityTokenService; | ||
import fr.paris.lutece.portal.service.template.AppTemplateService; | ||
import fr.paris.lutece.portal.service.util.AppLogService; | ||
import fr.paris.lutece.portal.service.util.AppPropertiesService; | ||
import fr.paris.lutece.portal.web.admin.AdminFeaturesPageJspBean; | ||
import fr.paris.lutece.util.html.HtmlTemplate; | ||
|
@@ -70,6 +71,10 @@ public class CacheJspBean extends AdminFeaturesPageJspBean | |
private static final String TEMPLATE_CACHE_INFOS = "admin/system/cache_infos.html"; | ||
private static final String PARAMETER_ID_CACHE = "id_cache"; | ||
|
||
// Conf | ||
private static final String PATH_CONF = "/WEB-INF/conf/"; | ||
private static final String FILE_PROPERTIES_CONFIG = "config.properties"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe you shoud not redefine these constants here, but share them with the normal intialisation process. Otherwise, there is a risk these become desynchronized There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's already defined in several places as private constants... Not sure if it's useful to declare them as public constants. Maybe in fr.paris.lutece.portal.web.constants.Parameters ? but it looks like this class is for parameters of http requests. |
||
|
||
/** | ||
* Returns the page to manage caches | ||
* | ||
|
@@ -138,6 +143,24 @@ public String doReloadProperties( HttpServletRequest request ) throws AccessDeni | |
return JSP_MANAGE_CACHES; | ||
} | ||
|
||
/** | ||
* Reload the logs configuration of the application | ||
* | ||
* @return The URL to display when the process is done. | ||
* @throws AccessDeniedException | ||
*/ | ||
public String doReloadLogsConfiguration( HttpServletRequest request ) throws AccessDeniedException | ||
{ | ||
if ( !SecurityTokenService.getInstance( ).validate( request, TEMPLATE_MANAGE_CACHES ) ) | ||
{ | ||
throw new AccessDeniedException( "Invalid security token" ); | ||
} | ||
AppLogService.init( PATH_CONF, FILE_PROPERTIES_CONFIG ); | ||
|
||
return JSP_MANAGE_CACHES; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should be able to add tests that
|
||
|
||
/** | ||
* Gets cache infos for all caches | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,10 @@ | |
<@button type='submit' buttonIcon='refresh' title='#i18n{portal.system.manage_caches.titleReloadProperties}' id='reload' size='' showTitleXs=false showTitleSm=false /> | ||
<@aButton href='jsp/admin/system/CacheInfos.jsp' buttonIcon='key' title='#i18n{portal.system.manage_caches.buttonViewKeys}' size='' showTitleXs=false showTitleSm=false /> | ||
</@tform> | ||
<@tform method='post' action='jsp/admin/system/DoReloadLogsConfiguration.jsp' class='pull-right spaced'> | ||
<input type="hidden" name="token" value="${token}"> | ||
<@button type='submit' buttonIcon='refresh' title='#i18n{portal.system.manage_caches.titleReloadLogsConfiguration}' id='reloadLogsConf' size='' showTitleXs=false showTitleSm=false /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the button shows no text on small screens ? Since there are no tooltips on smartphone, the purpose of this button might not be obvious There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we go with having this button on this page, then maybe we can use a single letter to disambiguate ? L and P. Or Logs and Props ? Or Logs and Properties ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not just display the title at all sizes ? |
||
</@tform> | ||
<@tform method='post' action='jsp/admin/system/DoResetCaches.jsp' class='pull-right spaced'> | ||
<input type="hidden" name="token" value="${token}"> | ||
<@button type='submit' buttonIcon='trash' title='#i18n{portal.system.manage_caches.buttonFlush}' size='' color='btn-danger' showTitleXs=false showTitleSm=false /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<%@ page errorPage="../ErrorPage.jsp" %> | ||
|
||
<jsp:useBean id="cache" scope="session" class="fr.paris.lutece.portal.web.system.CacheJspBean" /> | ||
|
||
<% | ||
cache.init( request , cache.RIGHT_CACHE_MANAGEMENT ); | ||
response.sendRedirect( cache.doReloadLogsConfiguration( request ) ); | ||
%> |
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.
Wouldn't that be "reloading" ?
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 chose the same expression as the other "reloading" button which says "Properties Loading". I don't have a strong opinion