You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Konstantin Kolinko <kn...@gmail.com> on 2012/12/03 12:09:26 UTC

Re: svn commit: r1415081 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/valves/ webapps/docs/ webapps/docs/config/

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

Best regards,
Konstantin Kolinko

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


Re: svn commit: r1415081 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/valves/ webapps/docs/ webapps/docs/config/

Posted by Rainer Jung <ra...@kippdata.de>.
On 03.12.2012 13:45, Konstantin Kolinko wrote:
> 2012/12/3 Rainer Jung <ra...@kippdata.de>:
>> On 03.12.2012 12:09, Konstantin Kolinko wrote:
>>> 2012/11/29  <rj...@apache.org>:

> On second thought,
> a) It is pointless to change server.xml if we are not also adding
> renameOnRotate="true" there. It is of little value.

Agreed.

> b) I wonder whether there will be some problems on Windows when using
> this feature. (A file deletion does not happen immediately there. I
> wonder what is the case with renames).

I haven't yet tried it, but the usual experience is that evenb if a file
is open so you can't delete it, you can still change its name. So I
expect it to work ...

> So I would keep the current default of renameOnRotate="false".

Me as well :)

> Maybe just add a configuration example to valves.html.

I did some reworking of the ALV docs, especially adding a general
paragraph about the file name. I hope this and move of the trailing dot
from the prefix default to a leading dot in the fileDateFormat default
should make it clear.

>>> a) It should be easy to extend this to skip rotation if file.length() is 0.
>>
>> Not so sure about that one. An empty rotated file shows there was
>> nothing written. Skipping rotation might lead to the question, whether
>> rotation is broken (or the server was down during the change of date).
>>
>> So I'd prefer keeping the rotation since it isn't so expensive and
>> doesn't happen to early.
>>
> 
> Just a different feature that people ask sometime: do not create a log
> file if it is empty.
> 
> An RFE for JULI:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=53620
> 
> An example is those "host-manager." logs that are in the default
> configuration, but nearly nobody is using that app.

Got it. I might come back to that one ...

Regards,

Rainer


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


Re: svn commit: r1415081 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/valves/ webapps/docs/ webapps/docs/config/

Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/12/3 Rainer Jung <ra...@kippdata.de>:
> 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).
>>>

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

The programmatic defaults serve different purpose than those in server.xml.

In server.xml we define the "global" access log (thus it is named as
"localhost" one).
In AccessLogValve there are defaults for any access log out there in the wild.

I was only thinking of updating the server.xml one by explicitly
defining fileDateFormat there.

On second thought,
a) It is pointless to change server.xml if we are not also adding
renameOnRotate="true" there. It is of little value.

b) I wonder whether there will be some problems on Windows when using
this feature. (A file deletion does not happen immediately there. I
wonder what is the case with renames).
So I would keep the current default of renameOnRotate="false".

Maybe just add a configuration example to valves.html.

>
>> a) It should be easy to extend this to skip rotation if file.length() is 0.
>
> Not so sure about that one. An empty rotated file shows there was
> nothing written. Skipping rotation might lead to the question, whether
> rotation is broken (or the server was down during the change of date).
>
> So I'd prefer keeping the rotation since it isn't so expensive and
> doesn't happen to early.
>

Just a different feature that people ask sometime: do not create a log
file if it is empty.

An RFE for JULI:
https://issues.apache.org/bugzilla/show_bug.cgi?id=53620

An example is those "host-manager." logs that are in the default
configuration, but nearly nobody is using that app.

Best regards,
Konstantin Kolinko

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


Re: svn commit: r1415081 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/valves/ webapps/docs/ webapps/docs/config/

Posted by Rainer Jung <ra...@kippdata.de>.
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1415081 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/valves/ webapps/docs/ webapps/docs/config/

Posted by Rainer Jung <ra...@kippdata.de>.
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.
> a) It should be easy to extend this to skip rotation if file.length() is 0.

Not so sure about that one. An empty rotated file shows there was
nothing written. Skipping rotation might lead to the question, whether
rotation is broken (or the server was down during the change of date).

So I'd prefer keeping the rotation since it isn't so expensive and
doesn't happen to early.

But maybe I misunderstood you.

Regards,

Rainer

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