Class LogRecorder

All Implemented Interfaces:
ModelObject, Saveable, SearchableModelObject, SearchItem, Loadable

public class LogRecorder extends AbstractModelObject implements Loadable, Saveable
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:
  • Field Details

  • Constructor Details

    • LogRecorder

      @DataBoundConstructor public LogRecorder(String name)
  • Method Details

    • getLoggers

      public List<LogRecorder.Target> getLoggers()
    • setLoggers

      public void setLoggers(List<LogRecorder.Target> loggers)
    • getAutoCompletionCandidates

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static Set<String> getAutoCompletionCandidates(List<String> loggerNamesList)
    • 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, otherwise FormValidation.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

      public String getDisplayName()
      Specified by:
      getDisplayName in interface ModelObject
    • getSearchUrl

      public String getSearchUrl()
      Description copied from interface: SearchItem
      Returns the URL of this item relative to the parent SearchItem.
      Specified by:
      getSearchUrl in interface SearchItem
      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

      public String getName()
    • getParent

      public LogRecorderManager 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:
      IOException
      javax.servlet.ServletException
    • doClear

      public org.kohsuke.stapler.HttpResponse doClear() throws IOException
      Throws:
      IOException
    • load

      public void load() throws IOException
      Loads the settings from a file.
      Specified by:
      load in interface Loadable
      Throws:
      IOException - The state could not be loaded.
    • save

      public void save() throws IOException
      Save the settings to a file.
      Specified by:
      save in interface Saveable
      Throws:
      IOException - if the persistence failed.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • doDoDelete

      public void doDoDelete(org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
      Deletes this recorder, then go back to the parent.
      Throws:
      IOException
      javax.servlet.ServletException
    • delete

      public void delete() throws IOException
      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:
      IOException
      javax.servlet.ServletException
    • getLogRecords

      public List<LogRecord> getLogRecords()
      Gets a view of the log records.
    • getSlaveLogRecords

      public Map<Computer,List<LogRecord>> 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