Package hudson.logging
Class LogRecorder
java.lang.Object
hudson.model.AbstractModelObject
hudson.logging.LogRecorder
- All Implemented Interfaces:
ModelObject
,Saveable
,SearchableModelObject
,SearchItem
,Loadable
Records a selected set of logs so that the system administrator
can diagnose a specific aspect of the system.
TODO: still a work in progress.
Access Control:
LogRecorder
is only visible for administrators and system readers, and this access control happens at
Jenkins.getLog()
, the sole entry point for binding LogRecorder
to URL.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static final class
Logger that this recorder monitors, and its log level. -
Field Summary
Modifier and TypeFieldDescriptionLog levels that can be configured forLogRecorder.Target
.Deprecated.static final com.thoughtworks.xstream.XStream
Thread-safe reusableXStream
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
delete()
Deletes this log recorder.doAutoCompleteLoggerName
(String value) doCheckName
(String value, String level) Validate the name.org.kohsuke.stapler.HttpResponse
doClear()
void
doConfigSubmit
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Accepts submission from the configuration page.void
doDoDelete
(org.kohsuke.stapler.StaplerResponse2 rsp) Deletes this recorder, then go back to the parent.void
doRss
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) RSS feed for log entries.boolean
getAutoCompletionCandidates
(List<String> loggerNamesList) Gets a view of the log records.getName()
Returns the URL of this item relative to the parentSearchItem
.Gets a view of log records per agent matching this recorder.int
hashCode()
void
load()
Loads the settings from a file.void
save()
Save the settings to a file.void
setLoggers
(List<LogRecorder.Target> loggers) Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendError
-
Field Details
-
targets
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("2.324") public final transient CopyOnWriteList<LogRecorder.Target> targetsDeprecated.usegetLoggers()
No longer used. -
XSTREAM
public static final com.thoughtworks.xstream.XStream XSTREAMThread-safe reusableXStream
. -
LEVELS
Log levels that can be configured forLogRecorder.Target
.
-
-
Constructor Details
-
LogRecorder
-
-
Method Details
-
getLoggers
-
setLoggers
-
getAutoCompletionCandidates
-
doCheckName
@NonNull @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public FormValidation doCheckName(@QueryParameter String value, @QueryParameter String level) Validate the name.- Returns:
FormValidation.ok(java.lang.String)
if the log target is not empty, otherwiseFormValidation.warning(java.lang.String)
with a message explaining the problem.
-
doAutoCompleteLoggerName
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public AutoCompletionCandidates doAutoCompleteLoggerName(@QueryParameter String value) -
getDisplayName
- Specified by:
getDisplayName
in interfaceModelObject
-
getSearchUrl
Description copied from interface:SearchItem
Returns the URL of this item relative to the parentSearchItem
.- Specified by:
getSearchUrl
in interfaceSearchItem
- Returns:
- URL like "foo" or "foo/bar". The path can end with '/'. The path that starts with '/' will be interpreted as the absolute path (within the context path of Jenkins.)
-
getName
-
getParent
-
doConfigSubmit
@POST public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Accepts submission from the configuration page.- Throws:
IOException
jakarta.servlet.ServletException
-
doClear
- Throws:
IOException
-
load
Loads the settings from a file.- Specified by:
load
in interfaceLoadable
- Throws:
IOException
- The state could not be loaded.
-
save
Save the settings to a file.- Specified by:
save
in interfaceSaveable
- Throws:
IOException
- if the persistence failed.
-
equals
-
hashCode
public int hashCode() -
doDoDelete
public void doDoDelete(org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Deletes this recorder, then go back to the parent.- Throws:
IOException
jakarta.servlet.ServletException
-
delete
Deletes this log recorder.- Throws:
IOException
- In case anything went wrong while deleting the configuration file.- Since:
- 2.425
-
doRss
public void doRss(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException RSS feed for log entries.- Throws:
IOException
jakarta.servlet.ServletException
-
getLogRecords
Gets a view of the log records. -
getSlaveLogRecords
Gets a view of log records per agent matching this recorder.- Returns:
- a map (sorted by display name) from computer to (nonempty) list of log records
- Since:
- 1.519
-
getLoggers()