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
Fields Modifier and Type Field Description protected static java.lang.String
LOG_FOLDER
Log folder path.protected CmsLogFileView
m_fileView
The log file view layout.protected CmsLogChannelTable
m_table
The log-channel table.protected static java.lang.String
PATH_LOGCHANNEL
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
Constructors Constructor Description CmsLogFileApp()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addChannelButton()
Button to open channel settings path.protected void
addDownloadButton(CmsLogFileView view)
Adds the download button.void
addMark(java.lang.String logFile)
Adds a marker entry to the currently selected log file.protected void
addMarkButton()
Button to add a marker to the current log file.protected void
addPublishButton()
Adds the publish button.protected void
addRefreshButton()
Button to refresh the file view.protected void
addSettingsButton()
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(java.lang.String elementId)
Performs a default action.void
deleteElements(java.util.List<java.lang.String> elementId)
Delete the given List of elements.protected void
filterTable(java.lang.String filter)
Filters the table.java.util.List<org.apache.logging.log4j.core.Logger>
getAllElements()
Get all Elements.java.util.Set<java.lang.String>
getAvailableLogFilePaths()
Gets the available log file paths.protected java.util.LinkedHashMap<java.lang.String,java.lang.String>
getBreadCrumbForState(java.lang.String state)
Returns the current bread crumb entries in an ordered map.protected com.vaadin.ui.Component
getComponentForState(java.lang.String state)
Returns the app component for the given state.java.lang.String
getDefaultLogFilePath(CmsRfsFileViewer logView)
Gets the default log file path.static java.lang.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(java.lang.String elementId)
Reads out an element.static java.lang.String
getFileName(org.apache.logging.log4j.core.Appender app)
Returns the file name ornull
associated with the given appender.protected I_CmsLogDownloadProvider
getLogDownloadProvider()
Gets the download provider for the log download dialog.java.lang.String
getLogFile(org.apache.logging.log4j.core.Logger logger)
Gets the log file for the logger.java.lang.String
getLogFilePortion(CmsRfsFileViewer logView, java.lang.String currentFile)
Gets the portion of given log file.protected java.util.List<A_CmsWorkplaceApp.NavEntry>
getSubNavEntries(java.lang.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
updateTable()
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 Detail
-
LOG_FOLDER
protected static final java.lang.String LOG_FOLDER
Log folder path.
-
PATH_LOGCHANNEL
protected static java.lang.String PATH_LOGCHANNEL
Path to channel settings view.
-
m_fileView
protected CmsLogFileView m_fileView
The log file view layout.
-
m_table
protected CmsLogChannelTable m_table
The log-channel table.
-
-
Constructor Detail
-
CmsLogFileApp
public CmsLogFileApp()
-
-
Method Detail
-
getDirectLogFile
public static java.lang.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.- Parameters:
logger
- to be checked- Returns:
- Log file name or null
-
getFileName
public static java.lang.String getFileName(org.apache.logging.log4j.core.Appender app)
Returns the file name ornull
associated with the given appender.- Parameters:
app
- the appender- Returns:
- the file name
-
isFileAppender
public 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.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
public static boolean isloggingactivated(org.apache.logging.log4j.core.Logger logchannel)
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
public static void toggleOwnFile(org.apache.logging.log4j.core.Logger logchannel)
Toggles the log file.- Parameters:
logchannel
- to toggle log file for
-
addMark
public void addMark(java.lang.String logFile)
Adds a marker entry to the currently selected log file.- Parameters:
logFile
- the log file name
-
createElement
public void createElement(org.apache.logging.log4j.core.Logger element)
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:
I_CmsCRUDApp.createElement(java.lang.Object)
-
defaultAction
public void defaultAction(java.lang.String elementId)
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:
I_CmsCRUDApp.defaultAction(java.lang.String)
-
deleteElements
public void deleteElements(java.util.List<java.lang.String> elementId)
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:
I_CmsCRUDApp.deleteElements(java.util.List)
-
getAllElements
public java.util.List<org.apache.logging.log4j.core.Logger> 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:
I_CmsCRUDApp.getAllElements()
-
getAvailableLogFilePaths
public java.util.Set<java.lang.String> getAvailableLogFilePaths()
Gets the available log file paths.- Returns:
- Set of paths
-
getDefaultLogFilePath
public java.lang.String getDefaultLogFilePath(CmsRfsFileViewer logView)
Gets the default log file path.- Parameters:
logView
- logview- Returns:
- log file path
-
getElement
public org.apache.logging.log4j.core.Logger getElement(java.lang.String elementId)
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:
I_CmsCRUDApp.getElement(java.lang.String)
-
getLogFile
public java.lang.String getLogFile(org.apache.logging.log4j.core.Logger logger)
Gets the log file for the logger.- Parameters:
logger
- to get log file for- Returns:
- log file
-
getLogFilePortion
public java.lang.String getLogFilePortion(CmsRfsFileViewer logView, java.lang.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
public void initUI(I_CmsAppUIContext context)
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:
A_CmsWorkplaceApp.initUI(org.opencms.ui.apps.I_CmsAppUIContext)
-
toggleOwnFileForLogger
public void toggleOwnFileForLogger(org.apache.logging.log4j.core.Logger logchannel)
Toggles if channel has own log file.- Parameters:
logchannel
- to toggle
-
updateTable
public void updateTable()
Updates the log channel table.
-
writeElement
public void writeElement(org.apache.logging.log4j.core.Logger logger)
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:
I_CmsCRUDApp.writeElement(java.lang.Object)
-
addChannelButton
protected void addChannelButton()
Button to open channel settings path.
-
addDownloadButton
protected void addDownloadButton(CmsLogFileView view)
Adds the download button.- Parameters:
view
- layout which displays the log file
-
addMarkButton
protected void addMarkButton()
Button to add a marker to the current log file.
-
addPublishButton
protected void addPublishButton()
Adds the publish button.
-
addRefreshButton
protected void addRefreshButton()
Button to refresh the file view.
-
addSettingsButton
protected void addSettingsButton()
Button to open log file view settings dialog.
-
filterTable
protected void filterTable(java.lang.String filter)
Filters the table.- Parameters:
filter
- text to be filtered
-
getBreadCrumbForState
protected java.util.LinkedHashMap<java.lang.String,java.lang.String> getBreadCrumbForState(java.lang.String state)
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:
A_CmsWorkplaceApp.getBreadCrumbForState(java.lang.String)
-
getComponentForState
protected com.vaadin.ui.Component getComponentForState(java.lang.String state)
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:
A_CmsWorkplaceApp.getComponentForState(java.lang.String)
-
getLogDownloadProvider
protected I_CmsLogDownloadProvider getLogDownloadProvider()
Gets the download provider for the log download dialog.
-
getSubNavEntries
protected java.util.List<A_CmsWorkplaceApp.NavEntry> getSubNavEntries(java.lang.String state)
Description copied from class:A_CmsWorkplaceApp
Returns the sub navigation entries.- Specified by:
getSubNavEntries
in classA_CmsWorkplaceApp
- Parameters:
state
- the state- Returns:
- the sub navigation entries
- See Also:
A_CmsWorkplaceApp.getSubNavEntries(java.lang.String)
-
-