Class LogViewerConlet
- All Implemented Interfaces:
Iterable<ComponentType>
,Channel
,ComponentType
,Eligible
,Manager
The class
LogViewerHandler
has to be registered as a handler in the
logging configuration (e.g. with
-Djava.util.logging.config.file=logging.properties
and
logging.properties
:
org.jgrapes.webconlet.logviewer.LogViewerHandler.level=CONFIG
The handler implements a ring buffer for the last 100
LogRecord
s. When the conlet is displayed, it obtains
the initially shown messages from the ring buffer. All subsequently
published LogRecord
s are forwarded to the conlet.
In order to limit the memory required in the browser, the conlet
also retains only the 100 most recent messages.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgrapes.webconsole.base.AbstractConlet
AbstractConlet.ConletTrackingInfo
Nested classes/interfaces inherited from interface org.jgrapes.core.Channel
Channel.Default
-
Field Summary
Fields inherited from class org.jgrapes.webconsole.base.AbstractConlet
TYPE_INSTANCE_SEPARATOR
-
Constructor Summary
ConstructorDescriptionLogViewerConlet
(Channel componentChannel) Creates a new component with its channel set to the given channel. -
Method Summary
Modifier and TypeMethodDescriptionprotected Set
<Conlet.RenderMode> doRenderConlet
(RenderConletRequestBase<?> event, ConsoleConnection channel, String conletId, Serializable conletState) Called byAbstractConlet.onAddConletRequest(AddConletRequest, ConsoleConnection)
andAbstractConlet.onRenderConletRequest(RenderConletRequest, ConsoleConnection)
to complete rendering the web console component.protected boolean
doSetLocale
(SetLocale event, ConsoleConnection channel, String conletId) Called byAbstractConlet.onSetLocale(SetLocale, ConsoleConnection)
for each web console component in the console connection.protected void
doUpdateConletState
(NotifyConletModel event, ConsoleConnection channel, Serializable conletState) Called byAbstractConlet.onNotifyConletModel(org.jgrapes.webconsole.base.events.NotifyConletModel, org.jgrapes.webconsole.base.ConsoleConnection)
to complete handling the notification.void
onConsoleReady
(ConsoleReady event, ConsoleConnection channel) OnConsoleReady
, fire theAddConletType
.Methods inherited from class org.jgrapes.webconsole.base.freemarker.FreeMarkerConlet
doGetResource, fmConletModel, fmModel, fmModel, fmSessionModel, fmTypeModel, freemarkerConfig, processTemplate, processTemplate
Methods inherited from class org.jgrapes.webconsole.base.AbstractConlet
afterOnClosed, conletIds, conletIdsByConsoleConnection, conletViews, createNewState, createStateRepresentation, doConletDeleted, doRemoveConletType, generateInstanceId, l10nBundles, localizations, onAddConletRequest, onClosed, onConletDeleted, onConletResourceRequest, onDetached, onNotifyConletModel, onRenderConletRequest, onSetLocale, putInSession, readContent, readContent, recreateState, removeState, resourceBundle, setPeriodicRefresh, stateFromSession, statesFromSession, supportedLocales, trackConlet, trackedConnections, type, typeFromId
Methods inherited from class org.jgrapes.core.Component
channel, component, defaultCriterion, isEligibleFor, setName
Methods inherited from class org.jgrapes.core.internal.ComponentVertex
activeEventPipeline, addHandler, attach, channelReplacements, children, componentPath, componentVertex, detach, fire, initComponentsHandlers, iterator, name, newEventPipeline, newEventPipeline, parent, registerAsGenerator, root, toString, unregisterAsGenerator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
LogViewerConlet
Creates a new component with its channel set to the given channel.- Parameters:
componentChannel
- the channel that the component’s handlers listen on by default and thatManager.fire(Event, Channel...)
sends the event to
-
-
Method Details
-
onConsoleReady
@Handler public void onConsoleReady(ConsoleReady event, ConsoleConnection channel) throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException OnConsoleReady
, fire theAddConletType
.- Parameters:
event
- the eventchannel
- the channel- Throws:
TemplateNotFoundException
- the template not found exceptionMalformedTemplateNameException
- the malformed template name exceptionParseException
- the parse exceptionIOException
- Signals that an I/O exception has occurred.
-
doRenderConlet
protected Set<Conlet.RenderMode> doRenderConlet(RenderConletRequestBase<?> event, ConsoleConnection channel, String conletId, Serializable conletState) throws Exception Description copied from class:AbstractConlet
Called byAbstractConlet.onAddConletRequest(AddConletRequest, ConsoleConnection)
andAbstractConlet.onRenderConletRequest(RenderConletRequest, ConsoleConnection)
to complete rendering the web console component.The
- Specified by:
doRenderConlet
in classAbstractConlet<Serializable>
- Parameters:
event
- the eventchannel
- the channelconletId
- the component idconletState
- the conlet’s state; may benull
if the conlet doesn’t have associated state information- Returns:
- the rendered modes
- Throws:
Exception
- the exception
-
doUpdateConletState
protected void doUpdateConletState(NotifyConletModel event, ConsoleConnection channel, Serializable conletState) throws Exception Description copied from class:AbstractConlet
Called byAbstractConlet.onNotifyConletModel(org.jgrapes.webconsole.base.events.NotifyConletModel, org.jgrapes.webconsole.base.ConsoleConnection)
to complete handling the notification.The default implementation does nothing.
- Overrides:
doUpdateConletState
in classAbstractConlet<Serializable>
- Parameters:
event
- the eventchannel
- the channelconletState
- the conlet’s state; may benull
if the conlet doesn’t have associated state information- Throws:
Exception
-
doSetLocale
protected boolean doSetLocale(SetLocale event, ConsoleConnection channel, String conletId) throws Exception Description copied from class:AbstractConlet
Called byAbstractConlet.onSetLocale(SetLocale, ConsoleConnection)
for each web console component in the console connection.Derived classes must send events for updating the representation to match the new locale.
If the method returns
false
this indicates that the representation cannot be updated without reloading the web console page.The default implementation fires a
RenderConletRequest
with tracked render modes (one of or bothConlet.RenderMode.Preview
andConlet.RenderMode.View
), thus updating the known representations. (Assuming that “Edit” and “Help” modes are represented with modal dialogs and therefore locale changes aren’t possible while these are open.)- Overrides:
doSetLocale
in classAbstractConlet<Serializable>
- Parameters:
event
- the eventchannel
- the channelconletId
- the web console component id- Returns:
- true, if adaption to new locale without reload is possible
- Throws:
Exception
- the exception
-