No the data record Im writing is about  446 bytes.  But dont know why the
maxsize param
does not limit the file size to 0.5 KB.

Anyways I found a workaround.  I  used a customised  RollingFileAppender
and configured it
for "minute"  rollover.

<param name="datePattern" value="'.'yyyy-MM-dd-HH-mm"/>

 Since my ConnectionMonitor Thread also logs the data record every minute,
I get
exactly one record in the log file.

Thanks Philip & everyone else for their valuable inputs.

Regards
-Gerard
                                                                                
        
                                                                                
        
                                                                                
        
                                                                                
        
                                                                                
        
                                                                                
        
                                                                                
        
                                                                                
        
                                                                                
        
                                                                                
        
                                                                                
        




                                                                           
             "Philip Denno"                                                
             <[EMAIL PROTECTED]                                             
             >                                                          To 
                                       "Log4J Users List"                  
             10/29/2005 01:50          <[email protected]>     
             AM                                                         cc 
                                                                           
                                                                   Subject 
             Please respond to         RE: Preventing File Append using    
               "Log4J Users            log4j                               
                   List"                                                   
             <[EMAIL PROTECTED]                                             
              ng.apache.org>                                               
                                                                           
                                                                           
                                                                           




Is the data record you are writing bigger than 0.5 KB?

If so then unfortunately I don't have any other ideas for file based
logging.

Have you given any thought to perhaps storing the record in another form
such as a database record?

Or even provide the data in real - time through a UI screen in your app.
In this way you would not need to log the data at all.

Cheers,
Philip.

-----Original Message-----
From: Gerard Menezes [mailto:[EMAIL PROTECTED]
Sent: October 28, 2005 12:47 AM
To: Log4J Users List
Subject: RE: Preventing File Append using log4j







Thanks Philip & James for your suggestions.

Unfortunately , it still didnt work.
log4j just refuses to wipe out all traces of it's logging (-:

Below is the appender config I used.
I have used the RollingFileAppender this time, and configured it for
minutely roll over, max size = 0.5 KB and MaxBackupIndex of 0.

<appender name="connectionPoolApp"
class="org.apache.log4j.RollingFileAppender">
            <param name="File" value="${log.dir}/connectionPools.log"/>
            <param name="datePattern" value="'.'yyyy-MM-dd-HH-mm"/>
            <param name="Append" value="false"/>
            <param name="MaxBackupIndex" value="0"/>
            <param name="MaxFileSize" value="0.5KB"/>
            <param name="ImmediateFlush" value="true"/>
            <layout class="org.apache.log4j.PatternLayout">
                  <param name="ConversionPattern" value="%d{ISO8601}
%-5p %c %m%n"/>
            </layout>
  </appender>


 Any suggestions are

 welcome.



 Thanks

 -Gerard


























             "Philip Denno"

             <[EMAIL PROTECTED]

             >
To
                                       "Log4J Users List"

             10/28/2005 06:26          <[email protected]>

             AM
cc



Subject
             Please respond to         RE: Preventing File Append using

               "Log4J Users            log4j

                   List"

             <[EMAIL PROTECTED]

              ng.apache.org>











I guess if you also set the max size on the file to some small number it
would roll after 1 entry.

Example:

             MaxFileSize=0.1MB

This means after the file gets to 100 KB it would roll and since your
max backups is set to zero it would overwrite.

You might be better served by simply implementing your own logging for
the connection pool and avoiding these kinds of hacks.

Cheers,
Philip.

-----Original Message-----
From: James Stauffer [mailto:[EMAIL PROTECTED]
Sent: October 27, 2005 7:43 AM
To: Log4J Users List
Subject: Re: Preventing File Append using log4j


Look at the rolling file appenders.  One of them has the option of
specifying the max backups.  If you set the max to 0 you would probably
be close to what you want.

On 10/26/05, Gerard Menezes <[EMAIL PROTECTED]> wrote:
> For an application, I need to log the Connection Pool status
> periodically, every minute in a log file.  I dont want to maintain a
> history of the log. So every minute, the log entry will replace the
> previous one, and so at any point of time, there should be just one
> entry in the log file.

--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to