406 * <p>
407 * The {@code FileHandler} is configured based on {@code LogManager}
408 * properties (or their default values) except that the given pattern
409 * argument is used as the filename pattern, the file limit is
410 * set to the limit argument, and the file count is set to the
411 * given count argument, and the append mode is set to the given
412 * {@code append} argument.
413 * <p>
414 * The count must be at least 1.
415 *
416 * @param pattern the pattern for naming the output file
417 * @param limit the maximum number of bytes to write to any one file
418 * @param count the number of files to use
419 * @param append specifies append mode
420 * @exception IOException if there are IO problems opening the files.
421 * @exception SecurityException if a security manager exists and if
422 * the caller does not have {@code LoggingPermission("control")}.
423 * @exception IllegalArgumentException if {@code limit < 0}, or {@code count < 1}.
424 * @exception IllegalArgumentException if pattern is an empty string
425 *
426 * @since 1.9
427 *
428 */
429 public FileHandler(String pattern, long limit, int count, boolean append)
430 throws IOException {
431 if (limit < 0 || count < 1 || pattern.length() < 1) {
432 throw new IllegalArgumentException();
433 }
434 checkPermission();
435 configure();
436 this.pattern = pattern;
437 this.limit = limit;
438 this.count = count;
439 this.append = append;
440 openFiles();
441 }
442
443 private boolean isParentWritable(Path path) {
444 Path parent = path.getParent();
445 if (parent == null) {
446 parent = path.toAbsolutePath().getParent();
|
406 * <p>
407 * The {@code FileHandler} is configured based on {@code LogManager}
408 * properties (or their default values) except that the given pattern
409 * argument is used as the filename pattern, the file limit is
410 * set to the limit argument, and the file count is set to the
411 * given count argument, and the append mode is set to the given
412 * {@code append} argument.
413 * <p>
414 * The count must be at least 1.
415 *
416 * @param pattern the pattern for naming the output file
417 * @param limit the maximum number of bytes to write to any one file
418 * @param count the number of files to use
419 * @param append specifies append mode
420 * @exception IOException if there are IO problems opening the files.
421 * @exception SecurityException if a security manager exists and if
422 * the caller does not have {@code LoggingPermission("control")}.
423 * @exception IllegalArgumentException if {@code limit < 0}, or {@code count < 1}.
424 * @exception IllegalArgumentException if pattern is an empty string
425 *
426 * @since 9
427 *
428 */
429 public FileHandler(String pattern, long limit, int count, boolean append)
430 throws IOException {
431 if (limit < 0 || count < 1 || pattern.length() < 1) {
432 throw new IllegalArgumentException();
433 }
434 checkPermission();
435 configure();
436 this.pattern = pattern;
437 this.limit = limit;
438 this.count = count;
439 this.append = append;
440 openFiles();
441 }
442
443 private boolean isParentWritable(Path path) {
444 Path parent = path.getParent();
445 if (parent == null) {
446 parent = path.toAbsolutePath().getParent();
|