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
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classLogger that this recorder monitors, and its log level. -
Field Summary
FieldsModifier and TypeFieldDescriptionLog levels that can be configured forLogRecorder.Target.Deprecated.static final com.thoughtworks.xstream.XStreamThread-safe reusableXStream. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()Deletes this log recorder.doAutoCompleteLoggerName(String value) doCheckName(String value, String level) Validate the name.org.kohsuke.stapler.HttpResponsedoClear()voiddoConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Accepts submission from the configuration page.voiddoDoDelete(org.kohsuke.stapler.StaplerResponse rsp) Deletes this recorder, then go back to the parent.voiddoRss(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) RSS feed for log entries.booleangetAutoCompletionCandidates(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.inthashCode()voidload()Loads the settings from a file.voidsave()Save the settings to a file.voidsetLoggers(List<LogRecorder.Target> loggers) Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, 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:
getDisplayNamein interfaceModelObject
-
getSearchUrl
Description copied from interface:SearchItemReturns the URL of this item relative to the parentSearchItem.- Specified by:
getSearchUrlin 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.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException Accepts submission from the configuration page.- Throws:
IOExceptionjavax.servlet.ServletException
-
doClear
- Throws:
IOException
-
load
Loads the settings from a file.- Specified by:
loadin interfaceLoadable- Throws:
IOException- The state could not be loaded.
-
save
Save the settings to a file.- Specified by:
savein interfaceSaveable- Throws:
IOException- if the persistence failed.
-
equals
-
hashCode
public int hashCode() -
doDoDelete
public void doDoDelete(org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException Deletes this recorder, then go back to the parent.- Throws:
IOExceptionjavax.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.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException RSS feed for log entries.- Throws:
IOExceptionjavax.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()