Package org.opencms.ui.apps.logfile
Class CmsLogFileApp
java.lang.Object
org.opencms.ui.apps.A_CmsWorkplaceApp
org.opencms.ui.apps.logfile.CmsLogFileApp
- All Implemented Interfaces:
I_CmsCRUDApp<org.apache.logging.log4j.core.Logger>
,I_CmsWorkplaceApp
public class CmsLogFileApp
extends A_CmsWorkplaceApp
implements I_CmsCRUDApp<org.apache.logging.log4j.core.Logger>
Main class of Log management app.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opencms.ui.apps.A_CmsWorkplaceApp
A_CmsWorkplaceApp.NavEntry
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
Log folder path.protected CmsLogFileView
The log file view layout.protected CmsLogChannelTable
The log-channel table.protected static String
Path to channel settings view.Fields inherited from class org.opencms.ui.apps.A_CmsWorkplaceApp
m_infoLayout, m_rootLayout, m_uiContext, PARAM_ASSIGN, PARAM_SEPARATOR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Button to open channel settings path.protected void
Adds the download button.void
Adds a marker entry to the currently selected log file.protected void
Button to add a marker to the current log file.protected void
Adds the publish button.protected void
Button to refresh the file view.protected void
Button to open log file view settings dialog.void
createElement
(org.apache.logging.log4j.core.Logger element) Creates the element of type T in the system.void
defaultAction
(String elementId) Performs a default action.void
deleteElements
(List<String> elementId) Delete the given List of elements.protected void
filterTable
(String filter) Filters the table.List<org.apache.logging.log4j.core.Logger>
Get all Elements.Gets the available log file paths.protected LinkedHashMap<String,
String> getBreadCrumbForState
(String state) Returns the current bread crumb entries in an ordered map.protected com.vaadin.ui.Component
getComponentForState
(String state) Returns the app component for the given state.getDefaultLogFilePath
(CmsRfsFileViewer logView) Gets the default log file path.static String
getDirectLogFile
(org.apache.logging.log4j.core.Logger logger) Gets the direct log filename of a given logger or null if no file is defined.org.apache.logging.log4j.core.Logger
getElement
(String elementId) Reads out an element.static String
getFileName
(org.apache.logging.log4j.core.Appender app) Returns the file name ornull
associated with the given appender.protected I_CmsLogDownloadProvider
Gets the download provider for the log download dialog.getLogFile
(org.apache.logging.log4j.core.Logger logger) Gets the log file for the logger.getLogFilePortion
(CmsRfsFileViewer logView, String currentFile) Gets the portion of given log file.protected List<A_CmsWorkplaceApp.NavEntry>
getSubNavEntries
(String state) Returns the sub navigation entries.void
initUI
(I_CmsAppUIContext context) Within this method the app UI should be initialized.static boolean
isFileAppender
(org.apache.logging.log4j.core.Appender appender) Checks whether the given log appender has a getFileName method to identify file based appenders.static boolean
isloggingactivated
(org.apache.logging.log4j.core.Logger logchannel) Simple check if the logger has the global log filestatic void
toggleOwnFile
(org.apache.logging.log4j.core.Logger logchannel) Toggles the log file.void
toggleOwnFileForLogger
(org.apache.logging.log4j.core.Logger logchannel) Toggles if channel has own log file.void
Updates the log channel table.void
writeElement
(org.apache.logging.log4j.core.Logger logger) Writes a changed element to the system which already exists.Methods inherited from class org.opencms.ui.apps.A_CmsWorkplaceApp
addParamToState, addSubNavEntry, getLastPathLevel, getOfflineCmsObject, getParamFromState, getParamsFromState, onStateChange, openSubView, removeParamsFromState, setBreadCrumbEntries, updateBreadCrumb, updateSubNav
-
Field Details
-
LOG_FOLDER
Log folder path. -
PATH_LOGCHANNEL
Path to channel settings view. -
m_fileView
The log file view layout. -
m_table
The log-channel table.
-
-
Constructor Details
-
CmsLogFileApp
public CmsLogFileApp()
-
-
Method Details
-
getDirectLogFile
Gets the direct log filename of a given logger or null if no file is defined.- Parameters:
logger
- to be checked- Returns:
- Log file name or null
-
getFileName
Returns the file name ornull
associated with the given appender.- Parameters:
app
- the appender- Returns:
- the file name
-
isFileAppender
Checks whether the given log appender has a getFileName method to identify file based appenders.As since log4j 2.0 file appenders don't have one common super class that allows access to the file name, but they all implement a method 'getFileName'.
- Parameters:
appender
- the appender to check- Returns:
- in case of a file based appender
-
isloggingactivated
Simple check if the logger has the global log fileor a single one.
- Parameters:
logchannel
- the channel that has do be checked- Returns:
- true if the the log channel has a single log file
-
toggleOwnFile
Toggles the log file.- Parameters:
logchannel
- to toggle log file for
-
addMark
Adds a marker entry to the currently selected log file.- Parameters:
logFile
- the log file name
-
createElement
Description copied from interface:I_CmsCRUDApp
Creates the element of type T in the system.- Specified by:
createElement
in interfaceI_CmsCRUDApp<org.apache.logging.log4j.core.Logger>
- Parameters:
element
- to be saved- See Also:
-
defaultAction
Description copied from interface:I_CmsCRUDApp
Performs a default action.- Specified by:
defaultAction
in interfaceI_CmsCRUDApp<org.apache.logging.log4j.core.Logger>
- Parameters:
elementId
- id of element- See Also:
-
deleteElements
Description copied from interface:I_CmsCRUDApp
Delete the given List of elements.- Specified by:
deleteElements
in interfaceI_CmsCRUDApp<org.apache.logging.log4j.core.Logger>
- Parameters:
elementId
- of elements to be deleted- See Also:
-
getAllElements
Description copied from interface:I_CmsCRUDApp
Get all Elements.- Specified by:
getAllElements
in interfaceI_CmsCRUDApp<org.apache.logging.log4j.core.Logger>
- Returns:
- a list of all elements
- See Also:
-
getAvailableLogFilePaths
Gets the available log file paths.- Returns:
- Set of paths
-
getDefaultLogFilePath
Gets the default log file path.- Parameters:
logView
- logview- Returns:
- log file path
-
getElement
Description copied from interface:I_CmsCRUDApp
Reads out an element.- Specified by:
getElement
in interfaceI_CmsCRUDApp<org.apache.logging.log4j.core.Logger>
- Parameters:
elementId
- of the object- Returns:
- the object of type T
- See Also:
-
getLogFile
Gets the log file for the logger.- Parameters:
logger
- to get log file for- Returns:
- log file
-
getLogFilePortion
public String getLogFilePortion(CmsRfsFileViewer logView, String currentFile) throws CmsRfsException, CmsRuntimeException Gets the portion of given log file.- Parameters:
logView
- to get portion withcurrentFile
- to read- Returns:
- portion of log file
- Throws:
CmsRfsException
- exceptionCmsRuntimeException
- exception
-
initUI
Description copied from interface:I_CmsWorkplaceApp
Within this method the app UI should be initialized.Use the context to add the app's components to the UI.
- Specified by:
initUI
in interfaceI_CmsWorkplaceApp
- Overrides:
initUI
in classA_CmsWorkplaceApp
- Parameters:
context
- the UI context- See Also:
-
toggleOwnFileForLogger
Toggles if channel has own log file.- Parameters:
logchannel
- to toggle
-
updateTable
Updates the log channel table. -
writeElement
Description copied from interface:I_CmsCRUDApp
Writes a changed element to the system which already exists.- Specified by:
writeElement
in interfaceI_CmsCRUDApp<org.apache.logging.log4j.core.Logger>
- Parameters:
logger
- to be saved- See Also:
-
addChannelButton
Button to open channel settings path. -
addDownloadButton
Adds the download button.- Parameters:
view
- layout which displays the log file
-
addMarkButton
Button to add a marker to the current log file. -
addPublishButton
Adds the publish button. -
addRefreshButton
Button to refresh the file view. -
addSettingsButton
Button to open log file view settings dialog. -
filterTable
Filters the table.- Parameters:
filter
- text to be filtered
-
getBreadCrumbForState
Description copied from class:A_CmsWorkplaceApp
Returns the current bread crumb entries in an ordered map.- Specified by:
getBreadCrumbForState
in classA_CmsWorkplaceApp
- Parameters:
state
- the current state- Returns:
- bread crumb entry name by state, in case the state is empty, the entry will be disabled
- See Also:
-
getComponentForState
Description copied from class:A_CmsWorkplaceApp
Returns the app component for the given state.- Specified by:
getComponentForState
in classA_CmsWorkplaceApp
- Parameters:
state
- the state to render- Returns:
- the app component
- See Also:
-
getLogDownloadProvider
Gets the download provider for the log download dialog.
-