On 03.12.2012 12:09, Konstantin Kolinko wrote:
> 2012/11/29  <rj...@apache.org>:
>> Author: rjung
>> Date: Thu Nov 29 08:33:47 2012
>> New Revision: 1415081
>>
>> URL: http://svn.apache.org/viewvc?rev=1415081&view=rev
>> Log:
>> Add new ALV attribute "renameOnRotate" (Default:false).
>>
>> If set to "true", the "fileDateFormat" will not be part
>> of the current log file. Only at the time of log rotation
>> the file is renamed to the final name including the
>> "fileDateFormat".
>>
>> This mimics the behavior e.g. of Log4J and similar frameworks,
>> where the active file does not have the timestamp in the file
>> name.
>>
>> Pro: current file has stable name, all files with
>>      timestamp in name are old.
>> Con: Slightly more complex impl.
>>
>> Backport of r1414889 from trunk.
>>
>> Modified:
>>     tomcat/tc7.0.x/trunk/   (props changed)
>>     tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/AccessLogValve.java
>>     
>> tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/LocalStrings.properties
>>     
>> tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/mbeans-descriptors.xml
>>     tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>>     tomcat/tc7.0.x/trunk/webapps/docs/config/valve.xml
>>
> 
> Interesting.
> Several notes. Just informational.

Thanks for testing!

> a) It should be easy to extend this to skip rotation if file.length() is 0.
> 
> b) The sample configuration in conf/server.xml is
> prefix="localhost_access_log." suffix=".txt"
> If I just enable this feature, I would get a file named
> "localhost_access_log..txt" with two dots.
> 
> A remedy is to explicitly define the fileDateFormat attribute and move
> the dot from prefix attribute into fileDateFormat one.

Yes, what about moving the trailing prefix dot to fileDateFormat for TC
8 and making the default fileDateFormat explicitly known by adding it to
the default server.xml? If we do so: should we still automatically set a
default fileDateFormat if the config contains an explicit empty one? I'd
say no (all for TC 8).

I'm reluctant about changing the default for TC 7 in case someone only
changed prefix or suffix or fileDateFormat and then will suddenly
observe different behavior. I think it is better to let the few people
using the feature fix their settings if they turn on renameOnRotate and
observe the double dot.

For the sake of completeness: the code and config defaults currently
differ slightly (TC 7 and 8):

Config:

prefix="localhost_access_log."
suffix=".txt"
fileDateFormat= Code Default

Code:

prefix="access_log.";
suffix="";
fileDateFormat="yyyy-MM-dd"

I would then move the trailing prefix dot in front of the fileDateFormat
default.

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to