TaskLog (Hadoop 0.20.2+320 API)
Date: 2010-06-28

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.mapred
Class TaskLog

    java.lang.Object
      org.apache.hadoop.mapred.TaskLog

    public class TaskLog

extends Object

A simple logger to handle the task-specific user logs. This class uses the system property `hadoop.log.dir`.

Nested Class Summary
`static class` | `TaskLog.LogName` The filter for userlogs.

Constructor Summary
`TaskLog()`

Method Summary
`static String` | `addCommand(List<String> cmd, boolean isExecutable)` Add quotes to each of the command strings and return as a single string
`static List<String>` | `captureDebugOut(List<String> cmd, File debugoutFilename)` Wrap a command in a shell to capture debug script's stdout and stderr to debugout.
`static List<String>` | `captureOutAndError(List<String> cmd, File stdoutFilename, File stderrFilename, long tailLength)` Wrap a command in a shell to capture stdout and stderr to files.
`static List<String>` | `captureOutAndError(List<String> setup, List<String> cmd, File stdoutFilename, File stderrFilename, long tailLength)` Wrap a command in a shell to capture stdout and stderr to files.
`static List<String>` | `captureOutAndError(List<String> setup, List<String> cmd, File stdoutFilename, File stderrFilename, long tailLength, String pidFileName)` Wrap a command in a shell to capture stdout and stderr to files.
`static void` | `cleanup(int logsRetainHours)` Purge old user logs.
`static File` | `getIndexFile(String taskid)`
`static File` | `getIndexFile(String taskid, boolean isCleanup)`
`static File` | `getRealTaskLogFileLocation(TaskAttemptID taskid, TaskLog.LogName filter)`
`static File` | `getTaskLogFile(TaskAttemptID taskid, TaskLog.LogName filter)`
`static long` | `getTaskLogLength(JobConf conf)` Get the desired maximum length of task's logs.
`static void` | `syncLogs(TaskAttemptID firstTaskid, TaskAttemptID taskid)`
`static void` | `syncLogs(TaskAttemptID firstTaskid, TaskAttemptID taskid, boolean isCleanup)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TaskLog

    public TaskLog()

Method Detail

### getTaskLogFile

    public static File getTaskLogFile(TaskAttemptID taskid,
                                      TaskLog.LogName filter)

### getRealTaskLogFileLocation

    public static File getRealTaskLogFileLocation(TaskAttemptID taskid,
                                                  TaskLog.LogName filter)

### getIndexFile

    public static File getIndexFile(String taskid)

### getIndexFile

    public static File getIndexFile(String taskid,
                                    boolean isCleanup)

### syncLogs

    public static void syncLogs(TaskAttemptID firstTaskid,
                                TaskAttemptID taskid)
                         throws IOException

  Throws:
    `IOException`

### syncLogs

    public static void syncLogs(TaskAttemptID firstTaskid,
                                TaskAttemptID taskid,
                                boolean isCleanup)
                         throws IOException

  Throws:
    `IOException`

### cleanup

    public static void cleanup(int logsRetainHours)
                        throws IOException

  Purge old user logs.

  Throws:
    `IOException`

### getTaskLogLength

    public static long getTaskLogLength(JobConf conf)

  Get the desired maximum length of task's logs.

  Parameters:
    `conf` - the job to look in
  Returns:
    the number of bytes to cap the log files at

### captureOutAndError

    public static List<String> captureOutAndError(List<String> cmd,
                                                  File stdoutFilename,
                                                  File stderrFilename,
                                                  long tailLength)
                                           throws IOException

  Wrap a command in a shell to capture stdout and stderr to files. If the tailLength is 0, the entire output will be saved.

  Parameters:
    `cmd` - The command and the arguments that should be run
    `stdoutFilename` - The filename that stdout should be saved to
    `stderrFilename` - The filename that stderr should be saved to
    `tailLength` - The length of the tail to be saved.
  Returns:
    the modified command that should be run
  Throws:
    `IOException`

### captureOutAndError

    public static List<String> captureOutAndError(List<String> setup,
                                                  List<String> cmd,
                                                  File stdoutFilename,
                                                  File stderrFilename,
                                                  long tailLength)
                                           throws IOException

  Wrap a command in a shell to capture stdout and stderr to files. Setup commands such as setting memory limit can be passed which will be executed before exec. If the tailLength is 0, the entire output will be saved.

  Parameters:
    `setup` - The setup commands for the execed process.
    `cmd` - The command and the arguments that should be run
    `stdoutFilename` - The filename that stdout should be saved to
    `stderrFilename` - The filename that stderr should be saved to
    `tailLength` - The length of the tail to be saved.
  Returns:
    the modified command that should be run
  Throws:
    `IOException`

### captureOutAndError

    public static List<String> captureOutAndError(List<String> setup,
                                                  List<String> cmd,
                                                  File stdoutFilename,
                                                  File stderrFilename,
                                                  long tailLength,
                                                  String pidFileName)
                                           throws IOException

  Wrap a command in a shell to capture stdout and stderr to files. Setup commands such as setting memory limit can be passed which will be executed before exec. If the tailLength is 0, the entire output will be saved.

  Parameters:
    `setup` - The setup commands for the execed process.
    `cmd` - The command and the arguments that should be run
    `stdoutFilename` - The filename that stdout should be saved to
    `stderrFilename` - The filename that stderr should be saved to
    `tailLength` - The length of the tail to be saved.
    `pidFileName` - The name of the pid-file
  Returns:
    the modified command that should be run
  Throws:
    `IOException`

### addCommand

    public static String addCommand(List<String> cmd,
                                    boolean isExecutable)
                             throws IOException

  Add quotes to each of the command strings and return as a single string

  Parameters:
    `cmd` - The command to be quoted
    `isExecutable` - makes shell path if the first argument is executable
  Returns:
    returns The quoted string.
  Throws:
    `IOException`

### captureDebugOut

    public static List<String> captureDebugOut(List<String> cmd,
                                               File debugoutFilename)
                                        throws IOException

  Wrap a command in a shell to capture debug script's stdout and stderr to debugout.

  Parameters:
    `cmd` - The command and the arguments that should be run
    `debugoutFilename` - The filename that stdout and stderr should be saved to.
  Returns:
    the modified command that should be run
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation