316 /** 317 * Initialize a <tt>FileHandler</tt> to write to a set of files. When 318 * (approximately) the given limit has been written to one file, 319 * another file will be opened. The output will cycle through a set 320 * of count files. 321 * <p> 322 * The <tt>FileHandler</tt> is configured based on <tt>LogManager</tt> 323 * properties (or their default values) except that the given pattern 324 * argument is used as the filename pattern, the file limit is 325 * set to the limit argument, and the file count is set to the 326 * given count argument. 327 * <p> 328 * The count must be at least 1. 329 * 330 * @param pattern the pattern for naming the output file 331 * @param limit the maximum number of bytes to write to any one file 332 * @param count the number of files to use 333 * @exception IOException if there are IO problems opening the files. 334 * @exception SecurityException if a security manager exists and if 335 * the caller does not have <tt>LoggingPermission("control")</tt>. 336 * @exception IllegalArgumentException if limit < 0, or count < 1. 337 * @exception IllegalArgumentException if pattern is an empty string 338 */ 339 public FileHandler(String pattern, int limit, int count) 340 throws IOException, SecurityException { 341 if (limit < 0 || count < 1 || pattern.length() < 1) { 342 throw new IllegalArgumentException(); 343 } 344 checkPermission(); 345 configure(); 346 this.pattern = pattern; 347 this.limit = limit; 348 this.count = count; 349 openFiles(); 350 } 351 352 /** 353 * Initialize a <tt>FileHandler</tt> to write to a set of files 354 * with optional append. When (approximately) the given limit has 355 * been written to one file, another file will be opened. The 356 * output will cycle through a set of count files. 357 * <p> 358 * The <tt>FileHandler</tt> is configured based on <tt>LogManager</tt> 359 * properties (or their default values) except that the given pattern 360 * argument is used as the filename pattern, the file limit is 361 * set to the limit argument, and the file count is set to the 362 * given count argument, and the append mode is set to the given 363 * <tt>append</tt> argument. 364 * <p> 365 * The count must be at least 1. 366 * 367 * @param pattern the pattern for naming the output file 368 * @param limit the maximum number of bytes to write to any one file 369 * @param count the number of files to use 370 * @param append specifies append mode 371 * @exception IOException if there are IO problems opening the files. 372 * @exception SecurityException if a security manager exists and if 373 * the caller does not have <tt>LoggingPermission("control")</tt>. 374 * @exception IllegalArgumentException if limit < 0, or count < 1. 375 * @exception IllegalArgumentException if pattern is an empty string 376 * 377 */ 378 public FileHandler(String pattern, int limit, int count, boolean append) 379 throws IOException, SecurityException { 380 if (limit < 0 || count < 1 || pattern.length() < 1) { 381 throw new IllegalArgumentException(); 382 } 383 checkPermission(); 384 configure(); 385 this.pattern = pattern; 386 this.limit = limit; 387 this.count = count; 388 this.append = append; 389 openFiles(); 390 } 391 392 /** 393 * Open the set of output files, based on the configured 394 * instance variables. | 316 /** 317 * Initialize a <tt>FileHandler</tt> to write to a set of files. When 318 * (approximately) the given limit has been written to one file, 319 * another file will be opened. The output will cycle through a set 320 * of count files. 321 * <p> 322 * The <tt>FileHandler</tt> is configured based on <tt>LogManager</tt> 323 * properties (or their default values) except that the given pattern 324 * argument is used as the filename pattern, the file limit is 325 * set to the limit argument, and the file count is set to the 326 * given count argument. 327 * <p> 328 * The count must be at least 1. 329 * 330 * @param pattern the pattern for naming the output file 331 * @param limit the maximum number of bytes to write to any one file 332 * @param count the number of files to use 333 * @exception IOException if there are IO problems opening the files. 334 * @exception SecurityException if a security manager exists and if 335 * the caller does not have <tt>LoggingPermission("control")</tt>. 336 * @exception IllegalArgumentException if {@code limit < 0}, or {@code count < 1}. 337 * @exception IllegalArgumentException if pattern is an empty string 338 */ 339 public FileHandler(String pattern, int limit, int count) 340 throws IOException, SecurityException { 341 if (limit < 0 || count < 1 || pattern.length() < 1) { 342 throw new IllegalArgumentException(); 343 } 344 checkPermission(); 345 configure(); 346 this.pattern = pattern; 347 this.limit = limit; 348 this.count = count; 349 openFiles(); 350 } 351 352 /** 353 * Initialize a <tt>FileHandler</tt> to write to a set of files 354 * with optional append. When (approximately) the given limit has 355 * been written to one file, another file will be opened. The 356 * output will cycle through a set of count files. 357 * <p> 358 * The <tt>FileHandler</tt> is configured based on <tt>LogManager</tt> 359 * properties (or their default values) except that the given pattern 360 * argument is used as the filename pattern, the file limit is 361 * set to the limit argument, and the file count is set to the 362 * given count argument, and the append mode is set to the given 363 * <tt>append</tt> argument. 364 * <p> 365 * The count must be at least 1. 366 * 367 * @param pattern the pattern for naming the output file 368 * @param limit the maximum number of bytes to write to any one file 369 * @param count the number of files to use 370 * @param append specifies append mode 371 * @exception IOException if there are IO problems opening the files. 372 * @exception SecurityException if a security manager exists and if 373 * the caller does not have <tt>LoggingPermission("control")</tt>. 374 * @exception IllegalArgumentException if {@code limit < 0}, or {@code count < 1}. 375 * @exception IllegalArgumentException if pattern is an empty string 376 * 377 */ 378 public FileHandler(String pattern, int limit, int count, boolean append) 379 throws IOException, SecurityException { 380 if (limit < 0 || count < 1 || pattern.length() < 1) { 381 throw new IllegalArgumentException(); 382 } 383 checkPermission(); 384 configure(); 385 this.pattern = pattern; 386 this.limit = limit; 387 this.count = count; 388 this.append = append; 389 openFiles(); 390 } 391 392 /** 393 * Open the set of output files, based on the configured 394 * instance variables. |