Results 1 to 3 of 3
  1. #1
    yebenes is offline Member
    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Default Maximum Backup Size in Log4J ERROR

    I use log4j in my applications for manage the log files. Now, I want to manage the number of backups and the maximum log size. For this, I use two methods of the API of log4j:

    setMaxBackupIndex(int maxBackups);

    setMaximumFileSize(long maxSize);

    The first works correctly, but the second not works. I configure the maximum size in 1024 bytes but the size of the files is 1066 bytes.

    Anyone know how fix it?

    Thanks! Regards, yebenes.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: Maximum Backup Size in Log4J ERROR

    This happens because of the way RollingFileAdapter works (which I presume you are using because you did not include much information otherwise) - it appends, then checks maximum file size and rolls over (for the next append) if the file size is equal to or exceeds the maximum set value.

  3. #3
    yebenes is offline Member
    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Default Re: Maximum Backup Size in Log4J ERROR

    Exactly, I use a RollingFileAdapter. Thanks for the information :)

Similar Threads

  1. JPanel getSize() getWidth(); also force maximum size?
    By AcousticBruce in forum New To Java
    Replies: 3
    Last Post: 02-23-2011, 04:22 AM
  2. get maximum heap size that can be allocated
    By gautam.aditya97 in forum Java 2D
    Replies: 3
    Last Post: 04-05-2010, 05:03 AM
  3. Maximum size of POST to Servlet
    By Ward in forum Java Servlet
    Replies: 0
    Last Post: 03-04-2009, 11:35 AM
  4. Replies: 2
    Last Post: 07-03-2007, 04:09 PM
  5. Maximum size of an array
    By Hasan in forum New To Java
    Replies: 1
    Last Post: 05-20-2007, 11:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •