Package hudson.logging
Class LogRecorder
- java.lang.Object
-
- hudson.model.AbstractModelObject
-
- hudson.logging.LogRecorder
-
- All Implemented Interfaces:
ModelObject
,Saveable
,SearchableModelObject
,SearchItem
public class LogRecorder extends AbstractModelObject implements 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 atJenkins.getLog()
, the sole entry point for bindingLogRecorder
to URL.- Author:
- Kohsuke Kawaguchi
- See Also:
LogRecorderManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LogRecorder.ComputerLogInitializer
static class
LogRecorder.Target
Logger that this recorder monitors, and its log level.
-
Field Summary
Fields Modifier and Type Field Description static List<Level>
LEVELS
Log levels that can be configured forLogRecorder.Target
.CopyOnWriteList<LogRecorder.Target>
targets
Deprecated.usegetLoggers()
static com.thoughtworks.xstream.XStream
XSTREAM
Thread-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 AutoCompletionCandidates
doAutoCompleteLoggerName(String value)
FormValidation
doCheckName(String value, String level)
Validate the name.org.kohsuke.stapler.HttpResponse
doClear()
void
doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
Accepts submission from the configuration page.void
doDoDelete(org.kohsuke.stapler.StaplerResponse rsp)
Deletes this recorder, then go back to the parent.void
doRss(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
RSS feed for log entries.boolean
equals(Object o)
static Set<String>
getAutoCompletionCandidates(List<String> loggerNamesList)
String
getDisplayName()
List<LogRecorder.Target>
getLoggers()
List<LogRecord>
getLogRecords()
Gets a view of the log records.String
getName()
LogRecorderManager
getParent()
String
getSearchUrl()
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.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
-
-
-
-
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:
getDisplayName
in interfaceModelObject
-
getSearchUrl
public String 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
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.- Throws:
IOException
-
save
public void save() throws IOException
Save the settings to a file.- Specified by:
save
in interfaceSaveable
- Throws:
IOException
- if the persistence failed.
-
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
-
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
-
-