Philip,

Thanks for your help.
Let me explain the scenario , so it would be more clear.

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.

This is done, so the customer can easily extract the Connection Pool status
at any time (on demand) and process it further.

I know this request is a bit odd & not the conventional way of using log4j,
but all the same I need to do it this way.

Im pasting an exercept of my logging configuration file "logging.xml"
for logging the ConnectionPool status.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="false"
xmlns:log4j="http://jakarta.apache.org/log4j/";>

<!-- Appenders -->

<appender name="connectionPoolApp" class="org.apache.log4j.FileAppender">
            <param name="File" value="${log.dir}/connectionPools.log"/>
            <param name="Append" value="false"/>
            <param name="ImmediateFlush" value="true"/>
            <layout class="org.apache.log4j.PatternLayout">
                  <param name="ConversionPattern" value="%d %-5p %c %m%n"/>
            </layout>
</appender>

<!-- Loggers -->

<logger name="com.qad.xmlengine.pools.ConnectionPool" additivity="false">
      <level value="INFO"/>
      <appender-ref ref="connectionPoolApp"/>
</logger>

</log4j:configuration>

Thanks
-Gerard





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




You mean you want the file to be over-written every time a log event
occurs? The append function in log4j applies to loggers so when you set
it to false it means your logger will not pass logging events to loggers
higher up in the hierarchy.

Log4j provides rolling files which are configurable as to when they
roll. This request seems a bit odd so maybe if you explained in more
detail what you want and also posted your config file.

Cheers,
Philip.

-----Original Message-----
From: Gerard Menezes [mailto:[EMAIL PROTECTED]
Sent: October 25, 2005 10:08 PM
To: [email protected]
Subject: Preventing File Append using log4j






Hi,

I'm using log4j and need to prevent File Append from happening. I need
the logging to be overwritten everytime it logs.

I've tried setting  <param name="Append" value="false"/>  in the
appender configuration, but it does not work.

Any suggestions ?
Thanks
-Gerard



---------------------------------------------------------------------
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