Package hudson.logging
Class LogRecorder
- java.lang.Object
-
- hudson.model.AbstractModelObject
-
- hudson.logging.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:
LogRecorderis only visible for administrators and system readers, and this access control happens atJenkins.getLog(), the sole entry point for bindingLogRecorderto URL.- Author:
- Kohsuke Kawaguchi
- See Also:
LogRecorderManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLogRecorder.ComputerLogInitializerstatic classLogRecorder.TargetLogger that this recorder monitors, and its log level.
-
Field Summary
Fields Modifier and Type Field Description static List<Level>LEVELSLog levels that can be configured forLogRecorder.Target.CopyOnWriteList<LogRecorder.Target>targetsDeprecated.usegetLoggers()static com.thoughtworks.xstream.XStreamXSTREAMThread-safe reusableXStream.
-
Constructor Summary
Constructors Constructor Description LogRecorder(String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete()Deletes this log recorder.AutoCompletionCandidatesdoAutoCompleteLoggerName(String value)FormValidationdoCheckName(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.booleanequals(Object o)static Set<String>getAutoCompletionCandidates(List<String> loggerNamesList)StringgetDisplayName()List<LogRecorder.Target>getLoggers()List<LogRecord>getLogRecords()Gets a view of the log records.StringgetName()LogRecorderManagergetParent()StringgetSearchUrl()Returns the URL of this item relative to the parentSearchItem.Map<Computer,List<LogRecord>>getSlaveLogRecords()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 Detail
-
targets
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @RestrictedSince("2.324") public final transient CopyOnWriteList<LogRecorder.Target> targets
Deprecated.usegetLoggers()No longer used.
-
XSTREAM
public static final com.thoughtworks.xstream.XStream XSTREAM
Thread-safe reusableXStream.
-
LEVELS
public static List<Level> LEVELS
Log levels that can be configured forLogRecorder.Target.
-
-
Constructor Detail
-
LogRecorder
@DataBoundConstructor public LogRecorder(String name)
-
-
Method Detail
-
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, 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
public String getDisplayName()
- Specified by:
getDisplayNamein interfaceModelObject
-
getSearchUrl
public String 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
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.ServletExceptionAccepts submission from the configuration page.- Throws:
IOExceptionjavax.servlet.ServletException
-
doClear
public org.kohsuke.stapler.HttpResponse doClear() throws IOException- Throws:
IOException
-
load
public void load() throws IOExceptionLoads the settings from a file.- Specified by:
loadin interfaceLoadable- Throws:
IOException- The state could not be loaded.
-
save
public void save() throws IOExceptionSave the settings to a file.- Specified by:
savein interfaceSaveable- Throws:
IOException- if the persistence failed.
-
doDoDelete
public void doDoDelete(org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletExceptionDeletes this recorder, then go back to the parent.- Throws:
IOExceptionjavax.servlet.ServletException
-
delete
public void delete() throws IOExceptionDeletes 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.ServletExceptionRSS feed for log entries.- Throws:
IOExceptionjavax.servlet.ServletException
-
-